From dbc0e36e7c7c81aad75ce19708c1a6d12ff6ad0b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:09:52 -0500 Subject: [PATCH 01/15] platform interface --- .../CHANGELOG.md | 4 ++ .../lib/src/platform_navigation_delegate.dart | 13 ++++ .../lib/src/types/types.dart | 1 + .../lib/src/types/url_change.dart | 29 +++++++++ .../pubspec.yaml | 2 +- .../platform_navigation_delegate_test.dart | 18 ++++-- .../platform_webview_controller_test.dart | 60 ++++--------------- ...latform_webview_controller_test.mocks.dart | 10 ++++ .../test/webview_platform_test.dart | 4 -- 9 files changed, 83 insertions(+), 58 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart diff --git a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md index 8641f8cfb062..31bd0968ad79 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.2 + +* Adds support to track url changes. See `PlatformNavigationDelegate.setOnUrlChange`. + ## 2.0.2 * Updates links for the merge of flutter/plugins into flutter/packages. 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 ec7af71eea51..096975b8c33e 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 @@ -22,6 +22,10 @@ typedef ProgressCallback = void Function(int progress); /// Signature for callbacks that report a resource loading error. typedef WebResourceErrorCallback = void Function(WebResourceError error); +/// Signature for callbacks that notify the host application of a change to the +/// url of the web view. +typedef UrlChangeCallback = void Function(UrlChange change); + /// An interface defining navigation events that occur on the native platform. /// /// The [PlatformWebViewController] is notifying this delegate on events that @@ -105,4 +109,13 @@ abstract class PlatformNavigationDelegate extends PlatformInterface { throw UnimplementedError( 'setOnWebResourceError is not implemented on the current platform.'); } + + /// Invoked when the underlying web view changes to a new url. + /// + /// See [PlatformWebViewController.setPlatformNavigationDelegate]. + Future setOnUrlChange(UrlChangeCallback onUrlChange) { + throw UnimplementedError( + 'setOnUrlChange is not implemented on the current platform.', + ); + } } 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 4df8800c83e1..693a2649a786 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 @@ -11,5 +11,6 @@ export 'platform_navigation_delegate_creation_params.dart'; export 'platform_webview_controller_creation_params.dart'; export 'platform_webview_cookie_manager_creation_params.dart'; export 'platform_webview_widget_creation_params.dart'; +export 'url_change.dart'; export 'web_resource_error.dart'; export 'webview_cookie.dart'; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart new file mode 100644 index 000000000000..f1976202c5ac --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. 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/cupertino.dart'; + +/// Details of the change to a web view's url. +/// +/// Platform specific implementations can add additional fields by extending +/// this class. +/// +/// This example demonstrates how to extend the [UrlChange] to provide +/// additional platform specific parameters: +/// +/// ```dart +/// class AndroidUrlChange extends UrlChange { +/// const AndroidUrlChange({required super.url, required this.isReload}); +/// +/// final bool isReload; +/// } +/// ``` +@immutable +class UrlChange { + /// Creates a new [UrlChange]. + const UrlChange({required this.url}); + + /// The new url of the web view. + final String? url; +} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index 0857aae1b0eb..da77d9790e28 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.0.2 +version: 2.1.0 environment: sdk: ">=2.12.0 <3.0.0" 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 5e9aa2e12437..58a9b7199c7d 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 @@ -51,7 +51,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setOnNavigationRequest should throw unimplemented error', () { final PlatformNavigationDelegate callbackDelegate = @@ -66,7 +65,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setOnPageStarted should throw unimplemented error', () { final PlatformNavigationDelegate callbackDelegate = @@ -80,7 +78,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setOnPageFinished should throw unimplemented error', () { final PlatformNavigationDelegate callbackDelegate = @@ -94,7 +91,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setOnProgress should throw unimplemented error', () { final PlatformNavigationDelegate callbackDelegate = @@ -108,7 +104,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setOnWebResourceError should throw unimplemented error', () { final PlatformNavigationDelegate callbackDelegate = @@ -120,6 +115,19 @@ void main() { throwsUnimplementedError, ); }); + + test( + 'Default implementation of setOnUrlChange should throw unimplemented error', + () { + final PlatformNavigationDelegate callbackDelegate = + ExtendsPlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams()); + + expect( + () => callbackDelegate.setOnUrlChange((UrlChange change) {}), + throwsUnimplementedError, + ); + }); } class MockWebViewPlatformWithMixin extends MockWebViewPlatform diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart index 6710f34895b7..648d4b019b2b 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart @@ -57,9 +57,7 @@ void main() { isNotNull); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of loadFile should throw unimplemented error', + test('Default implementation of loadFile should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -72,7 +70,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of loadFlutterAsset should throw unimplemented error', () { final PlatformWebViewController controller = @@ -86,7 +83,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of loadHtmlString should throw unimplemented error', () { final PlatformWebViewController controller = @@ -99,9 +95,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of loadRequest should throw unimplemented error', + test('Default implementation of loadRequest should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -113,9 +107,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of currentUrl should throw unimplemented error', + test('Default implementation of currentUrl should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -127,9 +119,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of canGoBack should throw unimplemented error', + test('Default implementation of canGoBack should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -142,7 +132,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of canGoForward should throw unimplemented error', () { final PlatformWebViewController controller = @@ -155,9 +144,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of goBack should throw unimplemented error', () { + test('Default implementation of goBack should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( const PlatformWebViewControllerCreationParams()); @@ -168,9 +155,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of goForward should throw unimplemented error', + test('Default implementation of goForward should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -182,9 +167,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of reload should throw unimplemented error', () { + test('Default implementation of reload should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( const PlatformWebViewControllerCreationParams()); @@ -195,9 +178,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of clearCache should throw unimplemented error', + test('Default implementation of clearCache should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -210,7 +191,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of clearLocalStorage should throw unimplemented error', () { final PlatformWebViewController controller = @@ -239,7 +219,6 @@ void main() { ); test( - // ignore: lines_longer_than_80_chars 'Default implementation of runJavaScript should throw unimplemented error', () { final PlatformWebViewController controller = @@ -253,7 +232,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of runJavaScriptReturningResult should throw unimplemented error', () { final PlatformWebViewController controller = @@ -267,7 +245,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of addJavaScriptChannel should throw unimplemented error', () { final PlatformWebViewController controller = @@ -286,7 +263,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of removeJavaScriptChannel should throw unimplemented error', () { final PlatformWebViewController controller = @@ -299,9 +275,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of getTitle should throw unimplemented error', + test('Default implementation of getTitle should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -313,9 +287,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of scrollTo should throw unimplemented error', + test('Default implementation of scrollTo should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -327,9 +299,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of scrollBy should throw unimplemented error', + test('Default implementation of scrollBy should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -342,7 +312,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of getScrollPosition should throw unimplemented error', () { final PlatformWebViewController controller = @@ -355,9 +324,7 @@ void main() { ); }); - test( - // ignore: lines_longer_than_80_chars - 'Default implementation of enableZoom should throw unimplemented error', + test('Default implementation of enableZoom should throw unimplemented error', () { final PlatformWebViewController controller = ExtendsPlatformWebViewController( @@ -370,7 +337,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setBackgroundColor should throw unimplemented error', () { final PlatformWebViewController controller = @@ -384,7 +350,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setJavaScriptMode should throw unimplemented error', () { final PlatformWebViewController controller = @@ -398,7 +363,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of setUserAgent should throw unimplemented error', () { final PlatformWebViewController controller = diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart index db142fe6a782..807ea02e0519 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.mocks.dart @@ -103,4 +103,14 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override + _i4.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => + (super.noSuchMethod( + Invocation.method( + #setOnUrlChange, + [onUrlChange], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.dart index ec24dd7f5fa2..f1e4dbb7442c 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/webview_platform_test.dart @@ -104,7 +104,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of createCookieManagerDelegate should throw unimplemented error', () { final WebViewPlatform webViewPlatform = ExtendsWebViewPlatform(); @@ -117,7 +116,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of createNavigationCallbackHandlerDelegate should throw unimplemented error', () { final WebViewPlatform webViewPlatform = ExtendsWebViewPlatform(); @@ -130,7 +128,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of createWebViewControllerDelegate should throw unimplemented error', () { final WebViewPlatform webViewPlatform = ExtendsWebViewPlatform(); @@ -143,7 +140,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of createWebViewWidgetDelegate should throw unimplemented error', () { final WebViewPlatform webViewPlatform = ExtendsWebViewPlatform(); From 14860c3299ec5fc0b36601af362865b024c14cb0 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 26 Feb 2023 18:15:48 -0500 Subject: [PATCH 02/15] android --- .../webview_flutter_android/CHANGELOG.md | 4 + .../GeneratedAndroidWebView.java | 3165 +++++++---------- .../WebViewClientHostApiImpl.java | 10 + .../webviewflutter/WebViewClientTest.java | 8 + .../webview_flutter_test.dart | 36 + .../example/lib/main.dart | 3 + .../example/pubspec.yaml | 8 + .../lib/src/android_proxy.dart | 2 + .../lib/src/android_webview.dart | 7 + .../lib/src/android_webview.g.dart | 513 ++- .../lib/src/android_webview_api_impls.dart | 24 + .../lib/src/android_webview_controller.dart | 27 + .../pigeons/android_webview.dart | 7 + .../webview_flutter_android/pubspec.yaml | 8 +- .../android_navigation_delegate_test.dart | 18 + .../test/android_webview_controller_test.dart | 6 + ...android_webview_controller_test.mocks.dart | 44 +- .../test/android_webview_test.dart | 27 + .../test/test_android_webview.g.dart | 450 +-- .../lib/src/types/url_change.dart | 2 +- .../pubspec.yaml | 2 +- 21 files changed, 1958 insertions(+), 2413 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 983ff4cdabbe..04743a642151 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.4.0 + +* Adds support for `PlatformNavigationDelegate.onUrlChange`. + ## 3.3.1 * Updates links for the merge of flutter/plugins into flutter/packages. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 425f6c1415bd..30309b544115 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -15,11 +15,12 @@ import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; -import java.util.ArrayList; import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.HashMap; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) @@ -28,34 +29,30 @@ public class GeneratedAndroidWebView { /** * Mode of how to select files for a file chooser. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * 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); private final int index; - private FileChooserMode(final int index) { this.index = index; } @@ -64,11 +61,7 @@ private FileChooserMode(final int index) { /** Generated class from Pigeon that represents data sent in messages. */ public static class FileChooserModeEnumData { private @NonNull FileChooserMode value; - - public @NonNull FileChooserMode getValue() { - return value; - } - + public @NonNull FileChooserMode getValue() { return value; } public void setValue(@NonNull FileChooserMode setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"value\" is null."); @@ -76,35 +69,29 @@ public void setValue(@NonNull FileChooserMode setterArg) { this.value = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ + /**Constructor is private to enforce null safety; use Builder. */ private FileChooserModeEnumData() {} - public static final class Builder { private @Nullable FileChooserMode value; - public @NonNull Builder setValue(@NonNull FileChooserMode setterArg) { this.value = setterArg; return this; } - public @NonNull FileChooserModeEnumData build() { FileChooserModeEnumData pigeonReturn = new FileChooserModeEnumData(); pigeonReturn.setValue(value); return pigeonReturn; } } - - @NonNull - ArrayList toList() { + @NonNull ArrayList toList() { ArrayList toListResult = new ArrayList(1); toListResult.add(value == null ? null : value.index); return toListResult; } - static @NonNull FileChooserModeEnumData fromList(@NonNull ArrayList list) { FileChooserModeEnumData pigeonResult = new FileChooserModeEnumData(); Object value = list.get(0); - pigeonResult.setValue(value == null ? null : FileChooserMode.values()[(int) value]); + pigeonResult.setValue(value == null ? null : FileChooserMode.values()[(int)value]); return pigeonResult; } } @@ -112,11 +99,7 @@ ArrayList toList() { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebResourceRequestData { private @NonNull String url; - - public @NonNull String getUrl() { - return url; - } - + public @NonNull String getUrl() { return url; } public void setUrl(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"url\" is null."); @@ -125,11 +108,7 @@ public void setUrl(@NonNull String setterArg) { } private @NonNull Boolean isForMainFrame; - - public @NonNull Boolean getIsForMainFrame() { - return isForMainFrame; - } - + public @NonNull Boolean getIsForMainFrame() { return isForMainFrame; } public void setIsForMainFrame(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"isForMainFrame\" is null."); @@ -138,21 +117,13 @@ public void setIsForMainFrame(@NonNull Boolean setterArg) { } private @Nullable Boolean isRedirect; - - public @Nullable Boolean getIsRedirect() { - return isRedirect; - } - + public @Nullable Boolean getIsRedirect() { return isRedirect; } public void setIsRedirect(@Nullable Boolean setterArg) { this.isRedirect = setterArg; } private @NonNull Boolean hasGesture; - - public @NonNull Boolean getHasGesture() { - return hasGesture; - } - + public @NonNull Boolean getHasGesture() { return hasGesture; } public void setHasGesture(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"hasGesture\" is null."); @@ -161,11 +132,7 @@ public void setHasGesture(@NonNull Boolean setterArg) { } private @NonNull String method; - - public @NonNull String getMethod() { - return method; - } - + public @NonNull String getMethod() { return method; } public void setMethod(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"method\" is null."); @@ -174,11 +141,7 @@ public void setMethod(@NonNull String setterArg) { } private @NonNull Map requestHeaders; - - public @NonNull Map getRequestHeaders() { - return requestHeaders; - } - + public @NonNull Map getRequestHeaders() { return requestHeaders; } public void setRequestHeaders(@NonNull Map setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"requestHeaders\" is null."); @@ -186,52 +149,39 @@ public void setRequestHeaders(@NonNull Map setterArg) { this.requestHeaders = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ + /**Constructor is private to enforce null safety; use Builder. */ private WebResourceRequestData() {} - public static final class Builder { private @Nullable String url; - public @NonNull Builder setUrl(@NonNull String setterArg) { this.url = setterArg; return this; } - private @Nullable Boolean isForMainFrame; - public @NonNull Builder setIsForMainFrame(@NonNull Boolean setterArg) { this.isForMainFrame = setterArg; return this; } - private @Nullable Boolean isRedirect; - public @NonNull Builder setIsRedirect(@Nullable Boolean setterArg) { this.isRedirect = setterArg; return this; } - private @Nullable Boolean hasGesture; - public @NonNull Builder setHasGesture(@NonNull Boolean setterArg) { this.hasGesture = setterArg; return this; } - private @Nullable String method; - public @NonNull Builder setMethod(@NonNull String setterArg) { this.method = setterArg; return this; } - private @Nullable Map requestHeaders; - public @NonNull Builder setRequestHeaders(@NonNull Map setterArg) { this.requestHeaders = setterArg; return this; } - public @NonNull WebResourceRequestData build() { WebResourceRequestData pigeonReturn = new WebResourceRequestData(); pigeonReturn.setUrl(url); @@ -243,9 +193,7 @@ public static final class Builder { return pigeonReturn; } } - - @NonNull - ArrayList toList() { + @NonNull ArrayList toList() { ArrayList toListResult = new ArrayList(6); toListResult.add(url); toListResult.add(isForMainFrame); @@ -255,21 +203,20 @@ ArrayList toList() { toListResult.add(requestHeaders); return toListResult; } - static @NonNull WebResourceRequestData fromList(@NonNull ArrayList list) { WebResourceRequestData pigeonResult = new WebResourceRequestData(); Object url = list.get(0); - pigeonResult.setUrl((String) url); + pigeonResult.setUrl((String)url); Object isForMainFrame = list.get(1); - pigeonResult.setIsForMainFrame((Boolean) isForMainFrame); + pigeonResult.setIsForMainFrame((Boolean)isForMainFrame); Object isRedirect = list.get(2); - pigeonResult.setIsRedirect((Boolean) isRedirect); + pigeonResult.setIsRedirect((Boolean)isRedirect); Object hasGesture = list.get(3); - pigeonResult.setHasGesture((Boolean) hasGesture); + pigeonResult.setHasGesture((Boolean)hasGesture); Object method = list.get(4); - pigeonResult.setMethod((String) method); + pigeonResult.setMethod((String)method); Object requestHeaders = list.get(5); - pigeonResult.setRequestHeaders((Map) requestHeaders); + pigeonResult.setRequestHeaders((Map)requestHeaders); return pigeonResult; } } @@ -277,11 +224,7 @@ ArrayList toList() { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebResourceErrorData { private @NonNull Long errorCode; - - public @NonNull Long getErrorCode() { - return errorCode; - } - + public @NonNull Long getErrorCode() { return errorCode; } public void setErrorCode(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"errorCode\" is null."); @@ -290,11 +233,7 @@ public void setErrorCode(@NonNull Long setterArg) { } private @NonNull String description; - - public @NonNull String getDescription() { - return description; - } - + public @NonNull String getDescription() { return description; } public void setDescription(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"description\" is null."); @@ -302,24 +241,19 @@ public void setDescription(@NonNull String setterArg) { this.description = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ + /**Constructor is private to enforce null safety; use Builder. */ private WebResourceErrorData() {} - public static final class Builder { private @Nullable Long errorCode; - public @NonNull Builder setErrorCode(@NonNull Long setterArg) { this.errorCode = setterArg; return this; } - private @Nullable String description; - public @NonNull Builder setDescription(@NonNull String setterArg) { this.description = setterArg; return this; } - public @NonNull WebResourceErrorData build() { WebResourceErrorData pigeonReturn = new WebResourceErrorData(); pigeonReturn.setErrorCode(errorCode); @@ -327,24 +261,18 @@ public static final class Builder { return pigeonReturn; } } - - @NonNull - ArrayList toList() { + @NonNull ArrayList toList() { ArrayList toListResult = new ArrayList(2); toListResult.add(errorCode); toListResult.add(description); return toListResult; } - static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode( - (errorCode == null) - ? null - : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer)errorCode : (Long)errorCode)); Object description = list.get(1); - pigeonResult.setDescription((String) description); + pigeonResult.setDescription((String)description); return pigeonResult; } } @@ -352,11 +280,7 @@ ArrayList toList() { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebViewPoint { private @NonNull Long x; - - public @NonNull Long getX() { - return x; - } - + public @NonNull Long getX() { return x; } public void setX(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"x\" is null."); @@ -365,11 +289,7 @@ public void setX(@NonNull Long setterArg) { } private @NonNull Long y; - - public @NonNull Long getY() { - return y; - } - + public @NonNull Long getY() { return y; } public void setY(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"y\" is null."); @@ -377,24 +297,19 @@ public void setY(@NonNull Long setterArg) { this.y = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ + /**Constructor is private to enforce null safety; use Builder. */ private WebViewPoint() {} - public static final class Builder { private @Nullable Long x; - public @NonNull Builder setX(@NonNull Long setterArg) { this.x = setterArg; return this; } - private @Nullable Long y; - public @NonNull Builder setY(@NonNull Long setterArg) { this.y = setterArg; return this; } - public @NonNull WebViewPoint build() { WebViewPoint pigeonReturn = new WebViewPoint(); pigeonReturn.setX(x); @@ -402,73 +317,65 @@ public static final class Builder { return pigeonReturn; } } - - @NonNull - ArrayList toList() { + @NonNull ArrayList toList() { ArrayList toListResult = new ArrayList(2); toListResult.add(x); toListResult.add(y); return toListResult; } - static @NonNull WebViewPoint fromList(@NonNull ArrayList list) { WebViewPoint pigeonResult = new WebViewPoint(); Object x = list.get(0); - pigeonResult.setX((x == null) ? null : ((x instanceof Integer) ? (Integer) x : (Long) x)); + pigeonResult.setX((x == null) ? null : ((x instanceof Integer) ? (Integer)x : (Long)x)); Object y = list.get(1); - pigeonResult.setY((y == null) ? null : ((y instanceof Integer) ? (Integer) y : (Long) y)); + pigeonResult.setY((y == null) ? null : ((y instanceof Integer) ? (Integer)y : (Long)y)); return pigeonResult; } } public interface Result { void success(T result); - void error(Throwable error); } /** * Handles methods calls to the native Java Object class. * - *

Also handles calls to remove the reference to an instance with `dispose`. + * Also handles calls to remove the reference to an instance with `dispose`. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { void dispose(@NonNull Long identifier); /** The codec used by JavaObjectHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaObjectHostApi.dispose", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaObjectHostApi.dispose", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number identifierArg = (Number) args.get(0); - if (identifierArg == null) { - throw new NullPointerException("identifierArg unexpectedly null."); - } - api.dispose((identifierArg == null) ? null : identifierArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number identifierArg = (Number)args.get(0); + if (identifierArg == null) { + throw new NullPointerException("identifierArg unexpectedly null."); + } + api.dispose((identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -478,141 +385,122 @@ static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { /** * Handles callbacks methods for the native Java Object class. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final BinaryMessenger binaryMessenger; - - public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger) { + public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by JavaObjectFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec()); - channel.send( - new ArrayList(Collections.singletonList(identifierArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec()); + channel.send(new ArrayList(Collections.singletonList(identifierArg)), channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { void clearCookies(Result result); - void setCookie(@NonNull String url, @NonNull String value); /** The codec used by CookieManagerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `CookieManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, CookieManagerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = - new Result() { - public void success(Boolean result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.clearCookies(resultCallback); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = new Result() { + public void success(Boolean result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); reply.reply(wrappedError); } - }); + }; + + api.clearCookies(resultCallback); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + reply.reply(wrappedError); + } + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setCookie", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setCookie", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - String urlArg = (String) args.get(0); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - String valueArg = (String) args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setCookie(urlArg, valueArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + String urlArg = (String)args.get(0); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + String valueArg = (String)args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setCookie(urlArg, valueArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } - private static class WebViewHostApiCodec extends StandardMessageCodec { public static final WebViewHostApiCodec INSTANCE = new WebViewHostApiCodec(); - private WebViewHostApiCodec() {} - @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: + case (byte)128: return WebViewPoint.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); + } } - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof WebViewPoint) { stream.write(128); writeValue(stream, ((WebViewPoint) value).toList()); - } else { + } else +{ super.writeValue(stream, value); } } @@ -621,939 +509,794 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebViewHostApi { void create(@NonNull Long instanceId, @NonNull Boolean useHybridComposition); - - void loadData( - @NonNull Long instanceId, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding); - - void loadDataWithBaseUrl( - @NonNull Long instanceId, - @Nullable String baseUrl, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding, - @Nullable String historyUrl); - - void loadUrl( - @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); - + void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); + void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); + void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - - @Nullable - String getUrl(@NonNull Long instanceId); - - @NonNull - Boolean canGoBack(@NonNull Long instanceId); - - @NonNull - Boolean canGoForward(@NonNull Long instanceId); - + @Nullable String getUrl(@NonNull Long instanceId); + @NonNull Boolean canGoBack(@NonNull Long instanceId); + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); - void goForward(@NonNull Long instanceId); - void reload(@NonNull Long instanceId); - void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - - void evaluateJavascript( - @NonNull Long instanceId, @NonNull String javascriptString, Result result); - - @Nullable - String getTitle(@NonNull Long instanceId); - + void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, Result result); + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - - @NonNull - Long getScrollX(@NonNull Long instanceId); - - @NonNull - Long getScrollY(@NonNull Long instanceId); - - @NonNull - WebViewPoint getScrollPosition(@NonNull Long instanceId); - + @NonNull Long getScrollX(@NonNull Long instanceId); + @NonNull Long getScrollY(@NonNull Long instanceId); + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); - void setWebViewClient(@NonNull Long instanceId, @NonNull Long webViewClientInstanceId); - void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - - void removeJavaScriptChannel( - @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - + void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); - void setWebChromeClient(@NonNull Long instanceId, @Nullable Long clientInstanceId); - void setBackgroundColor(@NonNull Long instanceId, @NonNull Long color); /** The codec used by WebViewHostApi. */ static MessageCodec getCodec() { - return WebViewHostApiCodec.INSTANCE; - } - /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + return WebViewHostApiCodec.INSTANCE; } + /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebViewHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean useHybridCompositionArg = (Boolean) args.get(1); - if (useHybridCompositionArg == null) { - throw new NullPointerException("useHybridCompositionArg unexpectedly null."); - } - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - useHybridCompositionArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean useHybridCompositionArg = (Boolean)args.get(1); + if (useHybridCompositionArg == null) { + throw new NullPointerException("useHybridCompositionArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), useHybridCompositionArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadData", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadData", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String dataArg = (String) args.get(1); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - String mimeTypeArg = (String) args.get(2); - String encodingArg = (String) args.get(3); - api.loadData( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - dataArg, - mimeTypeArg, - encodingArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String dataArg = (String)args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + String mimeTypeArg = (String)args.get(2); + String encodingArg = (String)args.get(3); + api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String baseUrlArg = (String) args.get(1); - String dataArg = (String) args.get(2); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - String mimeTypeArg = (String) args.get(3); - String encodingArg = (String) args.get(4); - String historyUrlArg = (String) args.get(5); - api.loadDataWithBaseUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - baseUrlArg, - dataArg, - mimeTypeArg, - encodingArg, - historyUrlArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String baseUrlArg = (String)args.get(1); + String dataArg = (String)args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + String mimeTypeArg = (String)args.get(3); + String encodingArg = (String)args.get(4); + String historyUrlArg = (String)args.get(5); + api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadUrl", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadUrl", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String urlArg = (String) args.get(1); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - Map headersArg = (Map) args.get(2); - if (headersArg == null) { - throw new NullPointerException("headersArg unexpectedly null."); - } - api.loadUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - urlArg, - headersArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String urlArg = (String)args.get(1); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + Map headersArg = (Map)args.get(2); + if (headersArg == null) { + throw new NullPointerException("headersArg unexpectedly null."); + } + api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.postUrl", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.postUrl", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String urlArg = (String) args.get(1); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - byte[] dataArg = (byte[]) args.get(2); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - api.postUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String urlArg = (String)args.get(1); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + byte[] dataArg = (byte[])args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getUrl", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getUrl", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String output = - api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoBack", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoBack", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean output = - api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoForward", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoForward", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean output = - api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goBack", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goBack", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goForward", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goForward", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.reload", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.reload", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.clearCache", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.clearCache", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean includeDiskFilesArg = (Boolean) args.get(1); - if (includeDiskFilesArg == null) { - throw new NullPointerException("includeDiskFilesArg unexpectedly null."); - } - api.clearCache( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - includeDiskFilesArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean includeDiskFilesArg = (Boolean)args.get(1); + if (includeDiskFilesArg == null) { + throw new NullPointerException("includeDiskFilesArg unexpectedly null."); + } + api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String javascriptStringArg = (String) args.get(1); - if (javascriptStringArg == null) { - throw new NullPointerException("javascriptStringArg unexpectedly null."); - } - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.evaluateJavascript( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - javascriptStringArg, - resultCallback); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String javascriptStringArg = (String)args.get(1); + if (javascriptStringArg == null) { + throw new NullPointerException("javascriptStringArg unexpectedly null."); + } + Result resultCallback = new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); reply.reply(wrappedError); } - }); + }; + + api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + reply.reply(wrappedError); + } + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getTitle", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getTitle", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String output = - api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollTo", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollTo", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number xArg = (Number) args.get(1); - if (xArg == null) { - throw new NullPointerException("xArg unexpectedly null."); - } - Number yArg = (Number) args.get(2); - if (yArg == null) { - throw new NullPointerException("yArg unexpectedly null."); - } - api.scrollTo( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number xArg = (Number)args.get(1); + if (xArg == null) { + throw new NullPointerException("xArg unexpectedly null."); + } + Number yArg = (Number)args.get(2); + if (yArg == null) { + throw new NullPointerException("yArg unexpectedly null."); + } + api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollBy", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollBy", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number xArg = (Number) args.get(1); - if (xArg == null) { - throw new NullPointerException("xArg unexpectedly null."); - } - Number yArg = (Number) args.get(2); - if (yArg == null) { - throw new NullPointerException("yArg unexpectedly null."); - } - api.scrollBy( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number xArg = (Number)args.get(1); + if (xArg == null) { + throw new NullPointerException("xArg unexpectedly null."); + } + Number yArg = (Number)args.get(2); + if (yArg == null) { + throw new NullPointerException("yArg unexpectedly null."); + } + api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollX", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollX", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Long output = - api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollY", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollY", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Long output = - api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollPosition", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollPosition", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - WebViewPoint output = - api.getScrollPosition( - (instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Boolean enabledArg = (Boolean) args.get(0); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setWebContentsDebuggingEnabled(enabledArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Boolean enabledArg = (Boolean)args.get(0); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setWebContentsDebuggingEnabled(enabledArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebViewClient", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebViewClient", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number webViewClientInstanceIdArg = (Number) args.get(1); - if (webViewClientInstanceIdArg == null) { - throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null."); - } - api.setWebViewClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewClientInstanceIdArg == null) - ? null - : webViewClientInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number webViewClientInstanceIdArg = (Number)args.get(1); + if (webViewClientInstanceIdArg == null) { + throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null."); + } + api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number javaScriptChannelInstanceIdArg = (Number) args.get(1); - if (javaScriptChannelInstanceIdArg == null) { - throw new NullPointerException( - "javaScriptChannelInstanceIdArg unexpectedly null."); - } - api.addJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number javaScriptChannelInstanceIdArg = (Number)args.get(1); + if (javaScriptChannelInstanceIdArg == null) { + throw new NullPointerException("javaScriptChannelInstanceIdArg unexpectedly null."); + } + api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number javaScriptChannelInstanceIdArg = (Number) args.get(1); - if (javaScriptChannelInstanceIdArg == null) { - throw new NullPointerException( - "javaScriptChannelInstanceIdArg unexpectedly null."); - } - api.removeJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number javaScriptChannelInstanceIdArg = (Number)args.get(1); + if (javaScriptChannelInstanceIdArg == null) { + throw new NullPointerException("javaScriptChannelInstanceIdArg unexpectedly null."); + } + api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number listenerInstanceIdArg = (Number) args.get(1); - api.setDownloadListener( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number listenerInstanceIdArg = (Number)args.get(1); + api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number clientInstanceIdArg = (Number) args.get(1); - api.setWebChromeClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number clientInstanceIdArg = (Number)args.get(1); + api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number colorArg = (Number) args.get(1); - if (colorArg == null) { - throw new NullPointerException("colorArg unexpectedly null."); - } - api.setBackgroundColor( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (colorArg == null) ? null : colorArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number colorArg = (Number)args.get(1); + if (colorArg == null) { + throw new NullPointerException("colorArg unexpectedly null."); + } + api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -1563,474 +1306,407 @@ public void error(Throwable error) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebSettingsHostApi { void create(@NonNull Long instanceId, @NonNull Long webViewInstanceId); - void setDomStorageEnabled(@NonNull Long instanceId, @NonNull Boolean flag); - void setJavaScriptCanOpenWindowsAutomatically(@NonNull Long instanceId, @NonNull Boolean flag); - void setSupportMultipleWindows(@NonNull Long instanceId, @NonNull Boolean support); - void setJavaScriptEnabled(@NonNull Long instanceId, @NonNull Boolean flag); - void setUserAgentString(@NonNull Long instanceId, @Nullable String userAgentString); - void setMediaPlaybackRequiresUserGesture(@NonNull Long instanceId, @NonNull Boolean require); - void setSupportZoom(@NonNull Long instanceId, @NonNull Boolean support); - void setLoadWithOverviewMode(@NonNull Long instanceId, @NonNull Boolean overview); - void setUseWideViewPort(@NonNull Long instanceId, @NonNull Boolean use); - void setDisplayZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled); - void setBuiltInZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled); - void setAllowFileAccess(@NonNull Long instanceId, @NonNull Boolean enabled); /** The codec used by WebSettingsHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebSettingsHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number webViewInstanceIdArg = (Number) args.get(1); - if (webViewInstanceIdArg == null) { - throw new NullPointerException("webViewInstanceIdArg unexpectedly null."); - } - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number webViewInstanceIdArg = (Number)args.get(1); + if (webViewInstanceIdArg == null) { + throw new NullPointerException("webViewInstanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean) args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setDomStorageEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean)args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean) args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setJavaScriptCanOpenWindowsAutomatically( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean)args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean supportArg = (Boolean) args.get(1); - if (supportArg == null) { - throw new NullPointerException("supportArg unexpectedly null."); - } - api.setSupportMultipleWindows( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean supportArg = (Boolean)args.get(1); + if (supportArg == null) { + throw new NullPointerException("supportArg unexpectedly null."); + } + api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean) args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setJavaScriptEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean)args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String userAgentStringArg = (String) args.get(1); - api.setUserAgentString( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - userAgentStringArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String userAgentStringArg = (String)args.get(1); + api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean requireArg = (Boolean) args.get(1); - if (requireArg == null) { - throw new NullPointerException("requireArg unexpectedly null."); - } - api.setMediaPlaybackRequiresUserGesture( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean requireArg = (Boolean)args.get(1); + if (requireArg == null) { + throw new NullPointerException("requireArg unexpectedly null."); + } + api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean supportArg = (Boolean) args.get(1); - if (supportArg == null) { - throw new NullPointerException("supportArg unexpectedly null."); - } - api.setSupportZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean supportArg = (Boolean)args.get(1); + if (supportArg == null) { + throw new NullPointerException("supportArg unexpectedly null."); + } + api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean overviewArg = (Boolean) args.get(1); - if (overviewArg == null) { - throw new NullPointerException("overviewArg unexpectedly null."); - } - api.setLoadWithOverviewMode( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean overviewArg = (Boolean)args.get(1); + if (overviewArg == null) { + throw new NullPointerException("overviewArg unexpectedly null."); + } + api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean useArg = (Boolean) args.get(1); - if (useArg == null) { - throw new NullPointerException("useArg unexpectedly null."); - } - api.setUseWideViewPort( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean useArg = (Boolean)args.get(1); + if (useArg == null) { + throw new NullPointerException("useArg unexpectedly null."); + } + api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean) args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setDisplayZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean)args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean) args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setBuiltInZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean)args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean) args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setAllowFileAccess( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean)args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2043,41 +1719,35 @@ public interface JavaScriptChannelHostApi { /** The codec used by JavaScriptChannelHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, JavaScriptChannelHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String channelNameArg = (String) args.get(1); - if (channelNameArg == null) { - throw new NullPointerException("channelNameArg unexpectedly null."); - } - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String channelNameArg = (String)args.get(1); + if (channelNameArg == null) { + throw new NullPointerException("channelNameArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2087,141 +1757,120 @@ static void setup(BinaryMessenger binaryMessenger, JavaScriptChannelHostApi api) /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaScriptChannelFlutterApi { private final BinaryMessenger binaryMessenger; - - public JavaScriptChannelFlutterApi(BinaryMessenger argBinaryMessenger) { + public JavaScriptChannelFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by JavaScriptChannelFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - - public void postMessage( - @NonNull Long instanceIdArg, @NonNull String messageArg, Reply callback) { + public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", - getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, messageArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - - void setSynchronousReturnValueForShouldOverrideUrlLoading( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `WebViewClientHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebViewClientHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean valueArg = (Boolean) args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean valueArg = (Boolean)args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } - private static class WebViewClientFlutterApiCodec extends StandardMessageCodec { public static final WebViewClientFlutterApiCodec INSTANCE = new WebViewClientFlutterApiCodec(); - private WebViewClientFlutterApiCodec() {} - @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: + case (byte)128: return WebResourceErrorData.fromList((ArrayList) readValue(buffer)); - - case (byte) 129: + + case (byte)129: return WebResourceRequestData.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); + } } - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof WebResourceErrorData) { stream.write(128); writeValue(stream, ((WebResourceErrorData) value).toList()); - } else if (value instanceof WebResourceRequestData) { + } else + if (value instanceof WebResourceRequestData) { stream.write(129); writeValue(stream, ((WebResourceRequestData) value).toList()); - } else { + } else +{ super.writeValue(stream, value); } } @@ -2230,127 +1879,64 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewClientFlutterApi { private final BinaryMessenger binaryMessenger; - - public WebViewClientFlutterApi(BinaryMessenger argBinaryMessenger) { + public WebViewClientFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by WebViewClientFlutterApi. */ static MessageCodec getCodec() { - return WebViewClientFlutterApiCodec.INSTANCE; + return WebViewClientFlutterApiCodec.INSTANCE; } - - public void onPageStarted( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - Reply callback) { + public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", - getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { + callback.reply(null); + }); } - - public void onPageFinished( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - Reply callback) { + public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", - getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { + callback.reply(null); + }); } - - public void onReceivedRequestError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull WebResourceErrorData errorArg, - Reply callback) { + public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", - getCodec()); - channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> { + callback.reply(null); + }); } - - public void onReceivedError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long errorCodeArg, - @NonNull String descriptionArg, - @NonNull String failingUrlArg, - Reply callback) { + public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", - getCodec()); - channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - webViewInstanceIdArg, - errorCodeArg, - descriptionArg, - failingUrlArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), channelReply -> { + callback.reply(null); + }); } - - public void requestLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - Reply callback) { + public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", - getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> { + callback.reply(null); + }); } - - public void urlLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - Reply callback) { + public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { + callback.reply(null); + }); + } + public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ @@ -2359,36 +1945,31 @@ public interface DownloadListenerHostApi { /** The codec used by DownloadListenerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `DownloadListenerHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, DownloadListenerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DownloadListenerHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.DownloadListenerHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2398,119 +1979,86 @@ static void setup(BinaryMessenger binaryMessenger, DownloadListenerHostApi api) /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class DownloadListenerFlutterApi { private final BinaryMessenger binaryMessenger; - - public DownloadListenerFlutterApi(BinaryMessenger argBinaryMessenger) { + public DownloadListenerFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by DownloadListenerFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - - public void onDownloadStart( - @NonNull Long instanceIdArg, - @NonNull String urlArg, - @NonNull String userAgentArg, - @NonNull String contentDispositionArg, - @NonNull String mimetypeArg, - @NonNull Long contentLengthArg, - Reply callback) { + public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", - getCodec()); - channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - urlArg, - userAgentArg, - contentDispositionArg, - mimetypeArg, - contentLengthArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - - void setSynchronousReturnValueForOnShowFileChooser( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `WebChromeClientHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebChromeClientHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean valueArg = (Boolean) args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setSynchronousReturnValueForOnShowFileChooser( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean valueArg = (Boolean)args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2519,73 +2067,62 @@ static void setup(BinaryMessenger binaryMessenger, WebChromeClientHostApi api) { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull - List list(@NonNull String path); - - @NonNull - String getAssetFilePathByName(@NonNull String name); + @NonNull List list(@NonNull String path); + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.list", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.list", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - String pathArg = (String) args.get(0); - if (pathArg == null) { - throw new NullPointerException("pathArg unexpectedly null."); - } - List output = api.list(pathArg); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + String pathArg = (String)args.get(0); + if (pathArg == null) { + throw new NullPointerException("pathArg unexpectedly null."); + } + List output = api.list(pathArg); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", - getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - String nameArg = (String) args.get(0); - if (nameArg == null) { - throw new NullPointerException("nameArg unexpectedly null."); - } - String output = api.getAssetFilePathByName(nameArg); - wrapped.add(0, output); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + String nameArg = (String)args.get(0); + if (nameArg == null) { + throw new NullPointerException("nameArg unexpectedly null."); + } + String output = api.getAssetFilePathByName(nameArg); + wrapped.add(0, output); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2595,150 +2132,118 @@ static void setup(BinaryMessenger binaryMessenger, FlutterAssetManagerHostApi ap /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebChromeClientFlutterApi { private final BinaryMessenger binaryMessenger; - - public WebChromeClientFlutterApi(BinaryMessenger argBinaryMessenger) { + public WebChromeClientFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by WebChromeClientFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - - public void onProgressChanged( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long progressArg, - Reply callback) { + public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", - getCodec()); - channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> { + callback.reply(null); + }); } - - public void onShowFileChooser( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long paramsInstanceIdArg, - Reply> callback) { + public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", - getCodec()); - channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), - channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List) channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List)channelReply; + callback.reply(output); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebStorageHostApi { void create(@NonNull Long instanceId); - void deleteAllData(@NonNull Long instanceId); /** The codec used by WebStorageHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); - } - /** - * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. - */ + return new StandardMessageCodec(); } + /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebStorageHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.create", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.deleteAllData", getCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.deleteAllData", getCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList) message; - assert args != null; - Number instanceIdArg = (Number) args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList)message; + assert args != null; + Number instanceIdArg = (Number)args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } + catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } - private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = - new FileChooserParamsFlutterApiCodec(); - + public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} - @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: + case (byte)128: return FileChooserModeEnumData.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); + } } - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof FileChooserModeEnumData) { stream.write(128); writeValue(stream, ((FileChooserModeEnumData) value).toList()); - } else { + } else +{ super.writeValue(stream, value); } } @@ -2747,53 +2252,35 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final BinaryMessenger binaryMessenger; - - public FileChooserParamsFlutterApi(BinaryMessenger argBinaryMessenger) { + public FileChooserParamsFlutterApi(BinaryMessenger argBinaryMessenger){ this.binaryMessenger = argBinaryMessenger; } - public interface Reply { void reply(T reply); } /** The codec used by FileChooserParamsFlutterApi. */ static MessageCodec getCodec() { - return FileChooserParamsFlutterApiCodec.INSTANCE; + return FileChooserParamsFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long instanceIdArg, - @NonNull Boolean isCaptureEnabledArg, - @NonNull List acceptTypesArg, - @NonNull FileChooserModeEnumData modeArg, - @Nullable String filenameHintArg, - Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); - channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), - channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); + channel.send(new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> { + callback.reply(null); + }); } } - - @NonNull - private static ArrayList wrapError(@NonNull Throwable exception) { + @NonNull private static ArrayList wrapError(@NonNull Throwable exception) { ArrayList errorList = new ArrayList<>(3); errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + errorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); return errorList; } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java index 09a34f2d4a85..6a33fc47125f 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java @@ -78,6 +78,11 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { return returnValueForShouldOverrideUrlLoading; } + @Override + public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) { + flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); + } + @Override public void onUnhandledKeyEvent(WebView view, KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be @@ -146,6 +151,11 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { return returnValueForShouldOverrideUrlLoading; } + @Override + public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) { + flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); + } + @Override public void onUnhandledKeyEvent(WebView view, KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java index 3267291b2e99..dad1242635ec 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java @@ -125,4 +125,12 @@ public WebViewClient createWebViewClient(WebViewClientFlutterApiImpl flutterApi) verify(mockWebViewClient).setReturnValueForShouldOverrideUrlLoading(false); } + + @Test + public void doUpdateVisitedHistory() { + webViewClient.doUpdateVisitedHistory(mockWebView, "https://www.google.com", true); + verify(mockFlutterApi) + .doUpdateVisitedHistory( + eq(webViewClient), eq(mockWebView), eq("https://www.google.com"), eq(true), any()); + } } diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index af144e55efba..c5382d361160 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -936,6 +936,42 @@ Future main() async { final String? currentUrl = await controller.currentUrl(); expect(currentUrl, secondaryUrl); }); + + testWidgets('can receive url changes', (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + )..setOnPageFinished((_) => pageLoaded.complete()); + + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ) + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setPlatformNavigationDelegate(navigationDelegate) + ..loadRequest(LoadRequestParams(uri: Uri.parse(blankPageEncoded))); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await pageLoaded.future; + await navigationDelegate.setOnPageFinished((_) {}); + + final Completer urlChangeCompleter = Completer(); + await navigationDelegate.setOnUrlChange((UrlChange change) { + urlChangeCompleter.complete(change.url); + }); + + await controller.runJavaScript('location.href = "$primaryUrl"'); + + await expectLater(urlChangeCompleter.future, completion(primaryUrl)); + }); }); testWidgets('target _blank opens in same window', 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 75f01b457b3a..e745e044c51b 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -123,6 +123,9 @@ Page resource error: } debugPrint('allowing navigation to ${request.url}'); return NavigationDecision.navigate; + }) + ..setOnUrlChange((UrlChange change) { + debugPrint('url change to ${change.url}'); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index 0fc0daf84118..11a2b50337a5 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -35,3 +35,11 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css + + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_android: + path: ../../../webview_flutter/webview_flutter_android + webview_flutter_platform_interface: + path: ../../../webview_flutter/webview_flutter_platform_interface \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart index 9437e9dd3eb4..a4166dae2aaf 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart @@ -68,6 +68,8 @@ class AndroidWebViewProxy { )? requestLoading, void Function(android_webview.WebView webView, String url)? urlLoading, + void Function(android_webview.WebView webView, String url, bool isReload)? + doUpdateVisitedHistory, }) createAndroidWebViewClient; /// Constructs a [android_webview.FlutterAssetManager]. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index 1ab30a9ea1fd..51f62ef9c48b 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -646,6 +646,7 @@ class WebViewClient extends JavaObject { @Deprecated('Only called on Android version < 23.') this.onReceivedError, this.requestLoading, this.urlLoading, + this.doUpdateVisitedHistory, }) : super.detached() { AndroidWebViewFlutterApis.instance.ensureSetUp(); api.createFromInstance(this); @@ -662,6 +663,7 @@ class WebViewClient extends JavaObject { @Deprecated('Only called on Android version < 23.') this.onReceivedError, this.requestLoading, this.urlLoading, + this.doUpdateVisitedHistory, }) : super.detached(); /// User authentication failed on server. @@ -804,6 +806,10 @@ class WebViewClient extends JavaObject { /// indicates whether the [WebView] loaded the URL. final void Function(WebView webView, String url)? urlLoading; + /// Notify the host application to update its visited links database. + final void Function(WebView webView, String url, bool isReload)? + doUpdateVisitedHistory; + /// Sets the required synchronous return value for the Java method, /// `WebViewClient.shouldOverrideUrlLoading(...)`. /// @@ -831,6 +837,7 @@ class WebViewClient extends JavaObject { onReceivedError: onReceivedError, requestLoading: requestLoading, urlLoading: urlLoading, + doUpdateVisitedHistory: doUpdateVisitedHistory, ); } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index d3c306a10238..dbe849a29017 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -19,12 +19,10 @@ 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. @@ -47,7 +45,8 @@ class FileChooserModeEnumData { static FileChooserModeEnumData decode(Object result) { result as List; return FileChooserModeEnumData( - value: FileChooserMode.values[result[0]! as int], + value: FileChooserMode.values[result[0]! as int] +, ); } } @@ -93,8 +92,7 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: - (result[5] as Map?)!.cast(), + requestHeaders: (result[5] as Map?)!.cast(), ); } } @@ -151,6 +149,7 @@ class WebViewPoint { } } + /// Handles methods calls to the native Java Object class. /// /// Also handles calls to remove the reference to an instance with `dispose`. @@ -189,6 +188,7 @@ class JavaObjectHostApi { } } + /// Handles callbacks methods for the native Java Object class. /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. @@ -197,8 +197,7 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -208,11 +207,10 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return; }); @@ -221,6 +219,7 @@ abstract class JavaObjectFlutterApi { } } + class CookieManagerHostApi { /// Constructor for [CookieManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -235,7 +234,8 @@ class CookieManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.clearCookies', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -295,11 +295,13 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -319,8 +321,7 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_useHybridComposition]) - as List?; + await channel.send([arg_instanceId, arg_useHybridComposition]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -337,14 +338,12 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, - String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -361,24 +360,12 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl( - int arg_instanceId, - String? arg_baseUrl, - String arg_data, - String? arg_mimeType, - String? arg_encoding, - String? arg_historyUrl) async { + Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_instanceId, - arg_baseUrl, - arg_data, - arg_mimeType, - arg_encoding, - arg_historyUrl - ]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -395,14 +382,12 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, - Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) - as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -419,13 +404,12 @@ class WebViewHostApi { } } - Future postUrl( - int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -589,8 +573,7 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) - as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -607,14 +590,12 @@ class WebViewHostApi { } } - Future evaluateJavascript( - int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) - as List?; + await channel.send([arg_instanceId, arg_javascriptString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -657,8 +638,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -679,8 +660,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -780,8 +761,7 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -801,14 +781,12 @@ class WebViewHostApi { } } - Future setWebViewClient( - int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_webViewClientInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -825,14 +803,12 @@ class WebViewHostApi { } } - Future addJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -849,14 +825,12 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -873,14 +847,12 @@ class WebViewHostApi { } } - Future setDownloadListener( - int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -897,14 +869,12 @@ class WebViewHostApi { } } - Future setWebChromeClient( - int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -925,8 +895,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_color]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -944,6 +914,7 @@ class WebViewHostApi { } } + class WebSettingsHostApi { /// Constructor for [WebSettingsHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -959,8 +930,7 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -981,8 +951,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -999,14 +969,12 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically( - int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1023,14 +991,12 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows( - int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1051,8 +1017,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1069,13 +1035,12 @@ class WebSettingsHostApi { } } - Future setUserAgentString( - int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1092,14 +1057,12 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture( - int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_require]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1120,8 +1083,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1138,13 +1101,12 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode( - int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_overview]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1165,8 +1127,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_use]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1183,13 +1145,12 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1206,13 +1167,12 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1233,8 +1193,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1252,6 +1212,7 @@ class WebSettingsHostApi { } } + class JavaScriptChannelHostApi { /// Constructor for [JavaScriptChannelHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1266,8 +1227,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1285,13 +1246,13 @@ class JavaScriptChannelHostApi { } } + abstract class JavaScriptChannelFlutterApi { static const MessageCodec codec = StandardMessageCodec(); void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1301,14 +1262,12 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null int.'); final String? arg_message = (args[1] as String?); - assert(arg_message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null String.'); + assert(arg_message != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null String.'); api.postMessage(arg_instanceId!, arg_message!); return; }); @@ -1317,6 +1276,7 @@ abstract class JavaScriptChannelFlutterApi { } } + class WebViewClientHostApi { /// Constructor for [WebViewClientHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1349,14 +1309,12 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1392,14 +1350,16 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return WebResourceRequestData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1411,19 +1371,17 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, - WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, - String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); - void requestLoading( - int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - static void setup(WebViewClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); + + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1433,17 +1391,14 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null String.'); api.onPageStarted(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); @@ -1458,17 +1413,14 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null String.'); api.onPageFinished(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); @@ -1476,32 +1428,24 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = - (args[3] as WebResourceErrorData?); - assert(arg_error != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, - arg_request!, arg_error!); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); + final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); + assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); return; }); } @@ -1515,25 +1459,19 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final int? arg_errorCode = (args[2] as int?); - assert(arg_errorCode != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_errorCode != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final String? arg_description = (args[3] as String?); - assert(arg_description != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); + assert(arg_description != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); final String? arg_failingUrl = (args[4] as String?); - assert(arg_failingUrl != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, - arg_errorCode!, arg_description!, arg_failingUrl!); + assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1547,20 +1485,15 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading( - arg_instanceId!, arg_webViewInstanceId!, arg_request!); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); + api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1574,25 +1507,47 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null String.'); api.urlLoading(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); + final int? arg_webViewInstanceId = (args[1] as int?); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); + final String? arg_url = (args[2] as String?); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null String.'); + final bool? arg_isReload = (args[3] as bool?); + assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); + api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + return; + }); + } + } } } + class DownloadListenerHostApi { /// Constructor for [DownloadListenerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1626,46 +1581,37 @@ class DownloadListenerHostApi { } } + abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, - String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', - codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_userAgent = (args[2] as String?); - assert(arg_userAgent != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_userAgent != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_contentDisposition = (args[3] as String?); - assert(arg_contentDisposition != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_contentDisposition != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_mimetype = (args[4] as String?); - assert(arg_mimetype != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_mimetype != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final int? arg_contentLength = (args[5] as int?); - assert(arg_contentLength != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, - arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1673,6 +1619,7 @@ abstract class DownloadListenerFlutterApi { } } + class WebChromeClientHostApi { /// Constructor for [WebChromeClientHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1705,14 +1652,12 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1730,6 +1675,7 @@ class WebChromeClientHostApi { } } + class FlutterAssetManagerHostApi { /// Constructor for [FlutterAssetManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1769,8 +1715,7 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1796,66 +1741,55 @@ class FlutterAssetManagerHostApi { } } + abstract class WebChromeClientFlutterApi { static const MessageCodec codec = StandardMessageCodec(); void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser( - int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); - static void setup(WebChromeClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); final int? arg_progress = (args[2] as int?); - assert(arg_progress != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged( - arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); final int? arg_paramsInstanceId = (args[2] as int?); - assert(arg_paramsInstanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser( - arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } @@ -1863,6 +1797,7 @@ abstract class WebChromeClientFlutterApi { } } + class WebStorageHostApi { /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1933,11 +1868,13 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1946,14 +1883,11 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = - _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, - FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -1963,25 +1897,18 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null int.'); final bool? arg_isCaptureEnabled = (args[1] as bool?); - assert(arg_isCaptureEnabled != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = - (args[2] as List?)?.cast(); - assert(arg_acceptTypes != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = - (args[3] as FileChooserModeEnumData?); - assert(arg_mode != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); + assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); + final List? arg_acceptTypes = (args[2] as List?)?.cast(); + assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); + final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); + assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, - arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); return; }); } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index 127a2fa58ef8..414304ad57e7 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -716,6 +716,30 @@ class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { instance.urlLoading!(webViewInstance!, url); } } + + @override + void doUpdateVisitedHistory( + int instanceId, + int webViewInstanceId, + String url, + bool isReload, + ) { + final WebViewClient? instance = instanceManager + .getInstanceWithWeakReference(instanceId) as WebViewClient?; + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + assert( + instance != null, + 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId', + ); + assert( + webViewInstance != null, + 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId', + ); + if (instance!.doUpdateVisitedHistory != null) { + instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); + } + } } /// Host api implementation for [DownloadListener]. 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 6bd3dc03746c..a5c5b21eb45c 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 @@ -702,6 +702,15 @@ class AndroidNavigationDelegateCreationParams final AndroidWebViewProxy androidWebViewProxy; } +/// Android details of the change to a web view's url. +class AndroidUrlChange extends UrlChange { + /// Constructs an [AndroidUrlChange]. + const AndroidUrlChange({required super.url, required this.isReload}); + + /// Whether the url is being reloaded. + final bool isReload; +} + /// A place to register callback methods responsible to handle navigation events /// triggered by the [android_webview.WebView]. class AndroidNavigationDelegate extends PlatformNavigationDelegate { @@ -776,6 +785,18 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { weakThis.target!._handleNavigation(url, isForMainFrame: true); } }, + doUpdateVisitedHistory: ( + android_webview.WebView webView, + String url, + bool isReload, + ) { + if (weakThis.target?._onUrlChange != null) { + weakThis.target!._onUrlChange!(AndroidUrlChange( + url: url, + isReload: isReload, + )); + } + }, ); _downloadListener = (this.params as AndroidNavigationDelegateCreationParams) @@ -831,6 +852,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { WebResourceErrorCallback? _onWebResourceError; NavigationRequestCallback? _onNavigationRequest; LoadRequestCallback? _onLoadRequest; + UrlChangeCallback? _onUrlChange; void _handleNavigation( String url, { @@ -911,4 +933,9 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { ) async { _onWebResourceError = onWebResourceError; } + + @override + Future setOnUrlChange(UrlChangeCallback onUrlChange) async { + _onUrlChange = onUrlChange; + } } diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 7f4d362c9273..b23d661379fc 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -268,6 +268,13 @@ abstract class WebViewClientFlutterApi { ); void urlLoading(int instanceId, int webViewInstanceId, String url); + + void doUpdateVisitedHistory( + int instanceId, + int webViewInstanceId, + String url, + bool isReload, + ); } @HostApi(dartHostTestHandler: 'TestDownloadListenerHostApi') diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 22edb68ef69c..f64afb27c44c 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.3.1 +version: 3.4.0 environment: sdk: ">=2.17.0 <3.0.0" @@ -30,3 +30,9 @@ dev_dependencies: sdk: flutter mockito: ^5.3.2 pigeon: ^4.2.14 + + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_platform_interface: + path: ../../webview_flutter/webview_flutter_platform_interface \ No newline at end of file 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 dac7c69a84f3..46c0f9068d63 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 @@ -437,6 +437,23 @@ void main() { expect(completer.isCompleted, true); }); }); + + test('onUrlChange', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + late final UrlChange urlChange; + androidNavigationDelegate + .setOnUrlChange((UrlChange change) => urlChange = change); + + CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( + android_webview.WebView.detached(), + 'https://www.google.com', + false, + ); + + expect(urlChange.url, 'https://www.google.com'); + }); } AndroidNavigationDelegateCreationParams _buildCreationParams() { @@ -460,6 +477,7 @@ class CapturingWebViewClient extends android_webview.WebViewClient { super.onReceivedRequestError, super.requestLoading, super.urlLoading, + super.doUpdateVisitedHistory, }) : super.detached() { lastCreatedDelegate = this; } diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index 43bab384e0cc..e44275de63f1 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -107,6 +107,12 @@ void main() { requestLoading, void Function(android_webview.WebView webView, String url)? urlLoading, + void Function( + android_webview.WebView webView, + String url, + bool isReload, + )? + doUpdateVisitedHistory, }) => mockWebViewClient ?? MockWebViewClient(), createFlutterAssetManager: () => 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 01885caff54c..b6596c28c57c 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 @@ -341,6 +341,16 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override + _i9.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => + (super.noSuchMethod( + Invocation.method( + #setOnUrlChange, + [onUrlChange], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewController]. @@ -349,6 +359,12 @@ class MockAndroidNavigationDelegate extends _i1.Mock class MockAndroidWebViewController extends _i1.Mock implements _i8.AndroidWebViewController { @override + int get webViewIdentifier => (super.noSuchMethod( + Invocation.getter(#webViewIdentifier), + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); + @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), returnValue: _FakePlatformWebViewControllerCreationParams_4( @@ -650,11 +666,11 @@ class MockAndroidWebViewController extends _i1.Mock @override _i9.Future setOnShowFileSelector( _i9.Future> Function(_i8.FileSelectorParams)? - onShowFileSelectorCallback) => + onShowFileSelector) => (super.noSuchMethod( Invocation.method( #setOnShowFileSelector, - [onShowFileSelectorCallback], + [onShowFileSelector], ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), @@ -741,6 +757,12 @@ class MockAndroidWebViewProxy extends _i1.Mock })); @override _i2.WebViewClient Function({ + void Function( + _i2.WebView, + String, + bool, + )? + doUpdateVisitedHistory, void Function( _i2.WebView, String, @@ -777,6 +799,12 @@ class MockAndroidWebViewProxy extends _i1.Mock }) get createAndroidWebViewClient => (super.noSuchMethod( Invocation.getter(#createAndroidWebViewClient), returnValue: ({ + void Function( + _i2.WebView, + String, + bool, + )? + doUpdateVisitedHistory, void Function( _i2.WebView, String, @@ -816,6 +844,12 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createAndroidWebViewClient), ), returnValueForMissingStub: ({ + void Function( + _i2.WebView, + String, + bool, + )? + doUpdateVisitedHistory, void Function( _i2.WebView, String, @@ -855,6 +889,12 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createAndroidWebViewClient), ), ) as _i2.WebViewClient Function({ + void Function( + _i2.WebView, + String, + bool, + )? + doUpdateVisitedHistory, void Function( _i2.WebView, String, diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart index 236d87da44eb..f97c03fc6bed 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart @@ -709,6 +709,33 @@ void main() { ); }); + test('doUpdateVisitedHistory', () { + late final List result; + when(mockWebViewClient.doUpdateVisitedHistory).thenReturn( + ( + WebView webView, + String url, + bool isReload, + ) { + result = [webView, url, isReload]; + }, + ); + + flutterApi.doUpdateVisitedHistory( + mockWebViewClientInstanceId, + mockWebViewInstanceId, + 'https://www.google.com', + false, + ); + + expect( + result, + containsAllInOrder( + [mockWebView, 'https://www.google.com', false], + ), + ); + }); + test('copy', () { expect(WebViewClient.detached().copy(), isA()); }); diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 56ba79a66622..cc0e22645e3f 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -13,6 +13,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:webview_flutter_android/src/android_webview.g.dart'; + /// Handles methods calls to the native Java Object class. /// /// Also handles calls to remove the reference to an instance with `dispose`. @@ -23,8 +24,7 @@ abstract class TestJavaObjectHostApi { void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, @@ -34,11 +34,10 @@ abstract class TestJavaObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return []; }); @@ -62,11 +61,13 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -76,11 +77,9 @@ abstract class TestWebViewHostApi { void create(int instanceId, bool useHybridComposition); - void loadData( - int instanceId, String data, String? mimeType, String? encoding); + void loadData(int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, - String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -128,8 +127,7 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, @@ -139,14 +137,12 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null int.'); final bool? arg_useHybridComposition = (args[1] as bool?); - assert(arg_useHybridComposition != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null bool.'); + assert(arg_useHybridComposition != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null bool.'); api.create(arg_instanceId!, arg_useHybridComposition!); return []; }); @@ -161,14 +157,12 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null int.'); final String? arg_data = (args[1] as String?); - assert(arg_data != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.'); + assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.'); final String? arg_mimeType = (args[2] as String?); final String? arg_encoding = (args[3] as String?); api.loadData(arg_instanceId!, arg_data!, arg_mimeType, arg_encoding); @@ -185,20 +179,17 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null int.'); final String? arg_baseUrl = (args[1] as String?); final String? arg_data = (args[2] as String?); - assert(arg_data != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.'); + assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.'); final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, - arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -212,18 +203,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = - (args[2] as Map?)?.cast(); - assert(arg_headers != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); + final Map? arg_headers = (args[2] as Map?)?.cast(); + assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); return []; }); @@ -238,17 +225,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null String.'); final Uint8List? arg_data = (args[2] as Uint8List?); - assert(arg_data != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null Uint8List.'); + assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null Uint8List.'); api.postUrl(arg_instanceId!, arg_url!, arg_data!); return []; }); @@ -263,11 +247,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return [output]; }); @@ -282,11 +265,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return [output]; }); @@ -301,11 +283,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return [output]; }); @@ -320,11 +301,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return []; }); @@ -339,11 +319,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return []; }); @@ -358,11 +337,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return []; }); @@ -377,14 +355,12 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null int.'); final bool? arg_includeDiskFiles = (args[1] as bool?); - assert(arg_includeDiskFiles != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null bool.'); + assert(arg_includeDiskFiles != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null bool.'); api.clearCache(arg_instanceId!, arg_includeDiskFiles!); return []; }); @@ -399,16 +375,13 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null int.'); final String? arg_javascriptString = (args[1] as String?); - assert(arg_javascriptString != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript( - arg_instanceId!, arg_javascriptString!); + assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); + final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -422,11 +395,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return [output]; }); @@ -441,17 +413,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); final int? arg_x = (args[1] as int?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); final int? arg_y = (args[2] as int?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); api.scrollTo(arg_instanceId!, arg_x!, arg_y!); return []; }); @@ -466,17 +435,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); final int? arg_x = (args[1] as int?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); final int? arg_y = (args[2] as int?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return []; }); @@ -491,11 +457,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null, expected non-null int.'); final int output = api.getScrollX(arg_instanceId!); return [output]; }); @@ -510,11 +475,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null, expected non-null int.'); final int output = api.getScrollY(arg_instanceId!); return [output]; }); @@ -529,11 +493,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null, expected non-null int.'); final WebViewPoint output = api.getScrollPosition(arg_instanceId!); return [output]; }); @@ -541,19 +504,17 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null, expected non-null bool.'); api.setWebContentsDebuggingEnabled(arg_enabled!); return []; }); @@ -568,14 +529,12 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); final int? arg_webViewClientInstanceId = (args[1] as int?); - assert(arg_webViewClientInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); + assert(arg_webViewClientInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); api.setWebViewClient(arg_instanceId!, arg_webViewClientInstanceId!); return []; }); @@ -590,16 +549,13 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); final int? arg_javaScriptChannelInstanceId = (args[1] as int?); - assert(arg_javaScriptChannelInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); + api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -613,16 +569,13 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); final int? arg_javaScriptChannelInstanceId = (args[1] as int?); - assert(arg_javaScriptChannelInstanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); + api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -636,11 +589,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.'); final int? arg_listenerInstanceId = (args[1] as int?); api.setDownloadListener(arg_instanceId!, arg_listenerInstanceId); return []; @@ -656,11 +608,10 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.'); final int? arg_clientInstanceId = (args[1] as int?); api.setWebChromeClient(arg_instanceId!, arg_clientInstanceId); return []; @@ -676,14 +627,12 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_color = (args[1] as int?); - assert(arg_color != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_color != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); api.setBackgroundColor(arg_instanceId!, arg_color!); return []; }); @@ -692,6 +641,7 @@ abstract class TestWebViewHostApi { } } + abstract class TestWebSettingsHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -721,8 +671,7 @@ abstract class TestWebSettingsHostApi { void setAllowFileAccess(int instanceId, bool enabled); - static void setup(TestWebSettingsHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, @@ -732,14 +681,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_webViewInstanceId!); return []; }); @@ -754,14 +701,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null bool.'); + assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null bool.'); api.setDomStorageEnabled(arg_instanceId!, arg_flag!); return []; }); @@ -769,46 +714,39 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically( - arg_instanceId!, arg_flag!); + assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); + api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null int.'); final bool? arg_support = (args[1] as bool?); - assert(arg_support != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null bool.'); + assert(arg_support != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null bool.'); api.setSupportMultipleWindows(arg_instanceId!, arg_support!); return []; }); @@ -823,14 +761,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_flag!); return []; }); @@ -845,11 +781,10 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null int.'); final String? arg_userAgentString = (args[1] as String?); api.setUserAgentString(arg_instanceId!, arg_userAgentString); return []; @@ -858,24 +793,20 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null int.'); final bool? arg_require = (args[1] as bool?); - assert(arg_require != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture( - arg_instanceId!, arg_require!); + assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); + api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); return []; }); } @@ -889,14 +820,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null int.'); final bool? arg_support = (args[1] as bool?); - assert(arg_support != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null bool.'); + assert(arg_support != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null bool.'); api.setSupportZoom(arg_instanceId!, arg_support!); return []; }); @@ -904,22 +833,19 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null int.'); final bool? arg_overview = (args[1] as bool?); - assert(arg_overview != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null bool.'); + assert(arg_overview != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null bool.'); api.setLoadWithOverviewMode(arg_instanceId!, arg_overview!); return []; }); @@ -934,14 +860,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null int.'); final bool? arg_use = (args[1] as bool?); - assert(arg_use != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null bool.'); + assert(arg_use != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null bool.'); api.setUseWideViewPort(arg_instanceId!, arg_use!); return []; }); @@ -956,14 +880,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null bool.'); api.setDisplayZoomControls(arg_instanceId!, arg_enabled!); return []; }); @@ -978,14 +900,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null bool.'); api.setBuiltInZoomControls(arg_instanceId!, arg_enabled!); return []; }); @@ -1000,14 +920,12 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null bool.'); api.setAllowFileAccess(arg_instanceId!, arg_enabled!); return []; }); @@ -1016,13 +934,13 @@ abstract class TestWebSettingsHostApi { } } + abstract class TestJavaScriptChannelHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, @@ -1032,14 +950,12 @@ abstract class TestJavaScriptChannelHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null int.'); final String? arg_channelName = (args[1] as String?); - assert(arg_channelName != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null String.'); + assert(arg_channelName != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null String.'); api.create(arg_instanceId!, arg_channelName!); return []; }); @@ -1048,16 +964,15 @@ abstract class TestJavaScriptChannelHostApi { } } + abstract class TestWebViewClientHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, @@ -1067,11 +982,10 @@ abstract class TestWebViewClientHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1079,24 +993,20 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null int.'); final bool? arg_value = (args[1] as bool?); - assert(arg_value != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - arg_instanceId!, arg_value!); + assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); + api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); return []; }); } @@ -1104,13 +1014,13 @@ abstract class TestWebViewClientHostApi { } } + abstract class TestDownloadListenerHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, @@ -1120,11 +1030,10 @@ abstract class TestDownloadListenerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1133,16 +1042,15 @@ abstract class TestDownloadListenerHostApi { } } + abstract class TestWebChromeClientHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, @@ -1152,11 +1060,10 @@ abstract class TestWebChromeClientHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1164,24 +1071,20 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null int.'); final bool? arg_value = (args[1] as bool?); - assert(arg_value != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser( - arg_instanceId!, arg_value!); + assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); return []; }); } @@ -1189,6 +1092,7 @@ abstract class TestWebChromeClientHostApi { } } + abstract class TestAssetManagerHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -1196,8 +1100,7 @@ abstract class TestAssetManagerHostApi { String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, @@ -1207,11 +1110,10 @@ abstract class TestAssetManagerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); - assert(arg_path != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null, expected non-null String.'); + assert(arg_path != null, 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null, expected non-null String.'); final List output = api.list(arg_path!); return [output]; }); @@ -1219,19 +1121,17 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null, expected non-null String.'); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null, expected non-null String.'); final String output = api.getAssetFilePathByName(arg_name!); return [output]; }); @@ -1240,6 +1140,7 @@ abstract class TestAssetManagerHostApi { } } + abstract class TestWebStorageHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -1247,8 +1148,7 @@ abstract class TestWebStorageHostApi { void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, @@ -1258,11 +1158,10 @@ abstract class TestWebStorageHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1277,11 +1176,10 @@ abstract class TestWebStorageHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null, expected non-null int.'); api.deleteAllData(arg_instanceId!); return []; }); diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart index f1976202c5ac..622b019e489a 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/url_change.dart @@ -26,4 +26,4 @@ class UrlChange { /// The new url of the web view. final String? url; -} \ No newline at end of file +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index da77d9790e28..d03c69fcf906 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.1.0 +version: 2.1.2 environment: sdk: ">=2.12.0 <3.0.0" From 9bf1f7fbc533cae8360671cfbb32de329d2c2eef Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:24:33 -0500 Subject: [PATCH 03/15] ios --- .../GeneratedAndroidWebView.java | 3180 ++++++++++------- .../lib/src/android_webview.g.dart | 510 +-- .../android_navigation_delegate_test.dart | 2 +- .../test/test_android_webview.g.dart | 450 ++- .../webview_flutter_wkwebview/CHANGELOG.md | 4 + .../webview_flutter_test.dart | 36 + .../ios/Runner.xcodeproj/project.pbxproj | 4 + .../example/ios/Runner/Info.plist | 2 + .../ios/RunnerTests/FWFObjectHostApiTests.m | 38 +- .../example/ios/RunnerTests/FWFURLTests.m | 48 + .../example/lib/main.dart | 3 + .../example/pubspec.yaml | 8 + .../ios/Classes/FLTWebViewFlutterPlugin.m | 4 + .../ios/Classes/FWFGeneratedWebKitApis.h | 446 +-- .../ios/Classes/FWFGeneratedWebKitApis.m | 1881 +++++----- .../ios/Classes/FWFObjectHostApi.m | 26 +- .../ios/Classes/FWFURLHostApi.h | 42 + .../ios/Classes/FWFURLHostApi.m | 74 + .../ios/Classes/webview-umbrella.h | 1 + .../lib/src/common/web_kit.g.dart | 894 +++-- .../lib/src/foundation/foundation.dart | 37 + .../src/foundation/foundation_api_impls.dart | 87 +- .../lib/src/webkit_webview_controller.dart | 45 +- .../pigeons/web_kit.dart | 39 +- .../webview_flutter_wkwebview/pubspec.yaml | 8 +- .../web_kit_cookie_manager_test.mocks.dart | 2 +- .../web_kit_webview_widget_test.mocks.dart | 2 +- .../test/src/common/test_web_kit.g.dart | 670 ++-- .../test/src/foundation/foundation_test.dart | 81 +- .../src/foundation/foundation_test.mocks.dart | 16 + .../test/src/ui_kit/ui_kit_test.mocks.dart | 2 +- .../test/src/web_kit/web_kit_test.mocks.dart | 2 +- ...webkit_navigation_delegate_test.mocks.dart | 2 +- .../test/webkit_webview_controller_test.dart | 67 + .../webkit_webview_controller_test.mocks.dart | 600 ++-- ...kit_webview_cookie_manager_test.mocks.dart | 2 +- .../webkit_webview_widget_test.mocks.dart | 2 +- 37 files changed, 5146 insertions(+), 4171 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 30309b544115..0a3c4a335de6 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -15,12 +15,11 @@ import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.HashMap; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) @@ -29,30 +28,34 @@ public class GeneratedAndroidWebView { /** * Mode of how to select files for a file chooser. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * 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); private final int index; + private FileChooserMode(final int index) { this.index = index; } @@ -61,7 +64,11 @@ private FileChooserMode(final int index) { /** Generated class from Pigeon that represents data sent in messages. */ public static class FileChooserModeEnumData { private @NonNull FileChooserMode value; - public @NonNull FileChooserMode getValue() { return value; } + + public @NonNull FileChooserMode getValue() { + return value; + } + public void setValue(@NonNull FileChooserMode setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"value\" is null."); @@ -69,29 +76,35 @@ public void setValue(@NonNull FileChooserMode setterArg) { this.value = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private FileChooserModeEnumData() {} + public static final class Builder { private @Nullable FileChooserMode value; + public @NonNull Builder setValue(@NonNull FileChooserMode setterArg) { this.value = setterArg; return this; } + public @NonNull FileChooserModeEnumData build() { FileChooserModeEnumData pigeonReturn = new FileChooserModeEnumData(); pigeonReturn.setValue(value); return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(1); toListResult.add(value == null ? null : value.index); return toListResult; } + static @NonNull FileChooserModeEnumData fromList(@NonNull ArrayList list) { FileChooserModeEnumData pigeonResult = new FileChooserModeEnumData(); Object value = list.get(0); - pigeonResult.setValue(value == null ? null : FileChooserMode.values()[(int)value]); + pigeonResult.setValue(value == null ? null : FileChooserMode.values()[(int) value]); return pigeonResult; } } @@ -99,7 +112,11 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebResourceRequestData { private @NonNull String url; - public @NonNull String getUrl() { return url; } + + public @NonNull String getUrl() { + return url; + } + public void setUrl(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"url\" is null."); @@ -108,7 +125,11 @@ public void setUrl(@NonNull String setterArg) { } private @NonNull Boolean isForMainFrame; - public @NonNull Boolean getIsForMainFrame() { return isForMainFrame; } + + public @NonNull Boolean getIsForMainFrame() { + return isForMainFrame; + } + public void setIsForMainFrame(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"isForMainFrame\" is null."); @@ -117,13 +138,21 @@ public void setIsForMainFrame(@NonNull Boolean setterArg) { } private @Nullable Boolean isRedirect; - public @Nullable Boolean getIsRedirect() { return isRedirect; } + + public @Nullable Boolean getIsRedirect() { + return isRedirect; + } + public void setIsRedirect(@Nullable Boolean setterArg) { this.isRedirect = setterArg; } private @NonNull Boolean hasGesture; - public @NonNull Boolean getHasGesture() { return hasGesture; } + + public @NonNull Boolean getHasGesture() { + return hasGesture; + } + public void setHasGesture(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"hasGesture\" is null."); @@ -132,7 +161,11 @@ public void setHasGesture(@NonNull Boolean setterArg) { } private @NonNull String method; - public @NonNull String getMethod() { return method; } + + public @NonNull String getMethod() { + return method; + } + public void setMethod(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"method\" is null."); @@ -141,7 +174,11 @@ public void setMethod(@NonNull String setterArg) { } private @NonNull Map requestHeaders; - public @NonNull Map getRequestHeaders() { return requestHeaders; } + + public @NonNull Map getRequestHeaders() { + return requestHeaders; + } + public void setRequestHeaders(@NonNull Map setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"requestHeaders\" is null."); @@ -149,39 +186,52 @@ public void setRequestHeaders(@NonNull Map setterArg) { this.requestHeaders = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private WebResourceRequestData() {} + public static final class Builder { private @Nullable String url; + public @NonNull Builder setUrl(@NonNull String setterArg) { this.url = setterArg; return this; } + private @Nullable Boolean isForMainFrame; + public @NonNull Builder setIsForMainFrame(@NonNull Boolean setterArg) { this.isForMainFrame = setterArg; return this; } + private @Nullable Boolean isRedirect; + public @NonNull Builder setIsRedirect(@Nullable Boolean setterArg) { this.isRedirect = setterArg; return this; } + private @Nullable Boolean hasGesture; + public @NonNull Builder setHasGesture(@NonNull Boolean setterArg) { this.hasGesture = setterArg; return this; } + private @Nullable String method; + public @NonNull Builder setMethod(@NonNull String setterArg) { this.method = setterArg; return this; } + private @Nullable Map requestHeaders; + public @NonNull Builder setRequestHeaders(@NonNull Map setterArg) { this.requestHeaders = setterArg; return this; } + public @NonNull WebResourceRequestData build() { WebResourceRequestData pigeonReturn = new WebResourceRequestData(); pigeonReturn.setUrl(url); @@ -193,7 +243,9 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(6); toListResult.add(url); toListResult.add(isForMainFrame); @@ -203,20 +255,21 @@ public static final class Builder { toListResult.add(requestHeaders); return toListResult; } + static @NonNull WebResourceRequestData fromList(@NonNull ArrayList list) { WebResourceRequestData pigeonResult = new WebResourceRequestData(); Object url = list.get(0); - pigeonResult.setUrl((String)url); + pigeonResult.setUrl((String) url); Object isForMainFrame = list.get(1); - pigeonResult.setIsForMainFrame((Boolean)isForMainFrame); + pigeonResult.setIsForMainFrame((Boolean) isForMainFrame); Object isRedirect = list.get(2); - pigeonResult.setIsRedirect((Boolean)isRedirect); + pigeonResult.setIsRedirect((Boolean) isRedirect); Object hasGesture = list.get(3); - pigeonResult.setHasGesture((Boolean)hasGesture); + pigeonResult.setHasGesture((Boolean) hasGesture); Object method = list.get(4); - pigeonResult.setMethod((String)method); + pigeonResult.setMethod((String) method); Object requestHeaders = list.get(5); - pigeonResult.setRequestHeaders((Map)requestHeaders); + pigeonResult.setRequestHeaders((Map) requestHeaders); return pigeonResult; } } @@ -224,7 +277,11 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebResourceErrorData { private @NonNull Long errorCode; - public @NonNull Long getErrorCode() { return errorCode; } + + public @NonNull Long getErrorCode() { + return errorCode; + } + public void setErrorCode(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"errorCode\" is null."); @@ -233,7 +290,11 @@ public void setErrorCode(@NonNull Long setterArg) { } private @NonNull String description; - public @NonNull String getDescription() { return description; } + + public @NonNull String getDescription() { + return description; + } + public void setDescription(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"description\" is null."); @@ -241,19 +302,24 @@ public void setDescription(@NonNull String setterArg) { this.description = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private WebResourceErrorData() {} + public static final class Builder { private @Nullable Long errorCode; + public @NonNull Builder setErrorCode(@NonNull Long setterArg) { this.errorCode = setterArg; return this; } + private @Nullable String description; + public @NonNull Builder setDescription(@NonNull String setterArg) { this.description = setterArg; return this; } + public @NonNull WebResourceErrorData build() { WebResourceErrorData pigeonReturn = new WebResourceErrorData(); pigeonReturn.setErrorCode(errorCode); @@ -261,18 +327,24 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(2); toListResult.add(errorCode); toListResult.add(description); return toListResult; } + static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer)errorCode : (Long)errorCode)); + pigeonResult.setErrorCode( + (errorCode == null) + ? null + : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); - pigeonResult.setDescription((String)description); + pigeonResult.setDescription((String) description); return pigeonResult; } } @@ -280,7 +352,11 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class WebViewPoint { private @NonNull Long x; - public @NonNull Long getX() { return x; } + + public @NonNull Long getX() { + return x; + } + public void setX(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"x\" is null."); @@ -289,7 +365,11 @@ public void setX(@NonNull Long setterArg) { } private @NonNull Long y; - public @NonNull Long getY() { return y; } + + public @NonNull Long getY() { + return y; + } + public void setY(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"y\" is null."); @@ -297,19 +377,24 @@ public void setY(@NonNull Long setterArg) { this.y = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private WebViewPoint() {} + public static final class Builder { private @Nullable Long x; + public @NonNull Builder setX(@NonNull Long setterArg) { this.x = setterArg; return this; } + private @Nullable Long y; + public @NonNull Builder setY(@NonNull Long setterArg) { this.y = setterArg; return this; } + public @NonNull WebViewPoint build() { WebViewPoint pigeonReturn = new WebViewPoint(); pigeonReturn.setX(x); @@ -317,65 +402,73 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(2); toListResult.add(x); toListResult.add(y); return toListResult; } + static @NonNull WebViewPoint fromList(@NonNull ArrayList list) { WebViewPoint pigeonResult = new WebViewPoint(); Object x = list.get(0); - pigeonResult.setX((x == null) ? null : ((x instanceof Integer) ? (Integer)x : (Long)x)); + pigeonResult.setX((x == null) ? null : ((x instanceof Integer) ? (Integer) x : (Long) x)); Object y = list.get(1); - pigeonResult.setY((y == null) ? null : ((y instanceof Integer) ? (Integer)y : (Long)y)); + pigeonResult.setY((y == null) ? null : ((y instanceof Integer) ? (Integer) y : (Long) y)); return pigeonResult; } } public interface Result { void success(T result); + void error(Throwable error); } /** * Handles methods calls to the native Java Object class. * - * Also handles calls to remove the reference to an instance with `dispose`. + *

Also handles calls to remove the reference to an instance with `dispose`. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { void dispose(@NonNull Long identifier); /** The codec used by JavaObjectHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaObjectHostApi.dispose", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.JavaObjectHostApi.dispose", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number identifierArg = (Number)args.get(0); - if (identifierArg == null) { - throw new NullPointerException("identifierArg unexpectedly null."); - } - api.dispose((identifierArg == null) ? null : identifierArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number identifierArg = (Number) args.get(0); + if (identifierArg == null) { + throw new NullPointerException("identifierArg unexpectedly null."); + } + api.dispose((identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -385,122 +478,141 @@ static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { /** * Handles callbacks methods for the native Java Object class. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final BinaryMessenger binaryMessenger; - public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger){ + + public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by JavaObjectFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec()); - channel.send(new ArrayList(Collections.singletonList(identifierArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { void clearCookies(Result result); + void setCookie(@NonNull String url, @NonNull String value); /** The codec used by CookieManagerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `CookieManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, CookieManagerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = new Result() { - public void success(Boolean result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = + new Result() { + public void success(Boolean result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.clearCookies(resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.clearCookies(resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setCookie", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setCookie", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String urlArg = (String)args.get(0); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - String valueArg = (String)args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setCookie(urlArg, valueArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String urlArg = (String) args.get(0); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + String valueArg = (String) args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setCookie(urlArg, valueArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } + private static class WebViewHostApiCodec extends StandardMessageCodec { public static final WebViewHostApiCodec INSTANCE = new WebViewHostApiCodec(); + private WebViewHostApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return WebViewPoint.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof WebViewPoint) { stream.write(128); writeValue(stream, ((WebViewPoint) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } @@ -509,794 +621,939 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebViewHostApi { void create(@NonNull Long instanceId, @NonNull Boolean useHybridComposition); - void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); - void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); - void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + + void loadData( + @NonNull Long instanceId, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding); + + void loadDataWithBaseUrl( + @NonNull Long instanceId, + @Nullable String baseUrl, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding, + @Nullable String historyUrl); + + void loadUrl( + @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable String getUrl(@NonNull Long instanceId); - @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull Boolean canGoForward(@NonNull Long instanceId); + + @Nullable + String getUrl(@NonNull Long instanceId); + + @NonNull + Boolean canGoBack(@NonNull Long instanceId); + + @NonNull + Boolean canGoForward(@NonNull Long instanceId); + void goBack(@NonNull Long instanceId); + void goForward(@NonNull Long instanceId); + void reload(@NonNull Long instanceId); + void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, Result result); - @Nullable String getTitle(@NonNull Long instanceId); + + void evaluateJavascript( + @NonNull Long instanceId, @NonNull String javascriptString, Result result); + + @Nullable + String getTitle(@NonNull Long instanceId); + void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); + void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); + + @NonNull + Long getScrollX(@NonNull Long instanceId); + + @NonNull + Long getScrollY(@NonNull Long instanceId); + + @NonNull + WebViewPoint getScrollPosition(@NonNull Long instanceId); + void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); + void setWebViewClient(@NonNull Long instanceId, @NonNull Long webViewClientInstanceId); + void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + + void removeJavaScriptChannel( + @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); + void setWebChromeClient(@NonNull Long instanceId, @Nullable Long clientInstanceId); + void setBackgroundColor(@NonNull Long instanceId, @NonNull Long color); /** The codec used by WebViewHostApi. */ static MessageCodec getCodec() { - return WebViewHostApiCodec.INSTANCE; } - /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + return WebViewHostApiCodec.INSTANCE; + } + /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, WebViewHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean useHybridCompositionArg = (Boolean)args.get(1); - if (useHybridCompositionArg == null) { - throw new NullPointerException("useHybridCompositionArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), useHybridCompositionArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean useHybridCompositionArg = (Boolean) args.get(1); + if (useHybridCompositionArg == null) { + throw new NullPointerException("useHybridCompositionArg unexpectedly null."); + } + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + useHybridCompositionArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadData", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadData", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String dataArg = (String)args.get(1); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - String mimeTypeArg = (String)args.get(2); - String encodingArg = (String)args.get(3); - api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String dataArg = (String) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + String mimeTypeArg = (String) args.get(2); + String encodingArg = (String) args.get(3); + api.loadData( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + dataArg, + mimeTypeArg, + encodingArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String baseUrlArg = (String)args.get(1); - String dataArg = (String)args.get(2); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - String mimeTypeArg = (String)args.get(3); - String encodingArg = (String)args.get(4); - String historyUrlArg = (String)args.get(5); - api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String baseUrlArg = (String) args.get(1); + String dataArg = (String) args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + String mimeTypeArg = (String) args.get(3); + String encodingArg = (String) args.get(4); + String historyUrlArg = (String) args.get(5); + api.loadDataWithBaseUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + baseUrlArg, + dataArg, + mimeTypeArg, + encodingArg, + historyUrlArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadUrl", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadUrl", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String urlArg = (String)args.get(1); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - Map headersArg = (Map)args.get(2); - if (headersArg == null) { - throw new NullPointerException("headersArg unexpectedly null."); - } - api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String urlArg = (String) args.get(1); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + Map headersArg = (Map) args.get(2); + if (headersArg == null) { + throw new NullPointerException("headersArg unexpectedly null."); + } + api.loadUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + urlArg, + headersArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.postUrl", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.postUrl", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String urlArg = (String)args.get(1); - if (urlArg == null) { - throw new NullPointerException("urlArg unexpectedly null."); - } - byte[] dataArg = (byte[])args.get(2); - if (dataArg == null) { - throw new NullPointerException("dataArg unexpectedly null."); - } - api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String urlArg = (String) args.get(1); + if (urlArg == null) { + throw new NullPointerException("urlArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + api.postUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getUrl", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getUrl", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String output = + api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoBack", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoBack", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean output = + api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoForward", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.canGoForward", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean output = + api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goBack", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goBack", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goForward", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.goForward", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.reload", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.reload", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.clearCache", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.clearCache", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean includeDiskFilesArg = (Boolean)args.get(1); - if (includeDiskFilesArg == null) { - throw new NullPointerException("includeDiskFilesArg unexpectedly null."); - } - api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean includeDiskFilesArg = (Boolean) args.get(1); + if (includeDiskFilesArg == null) { + throw new NullPointerException("includeDiskFilesArg unexpectedly null."); + } + api.clearCache( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + includeDiskFilesArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String javascriptStringArg = (String)args.get(1); - if (javascriptStringArg == null) { - throw new NullPointerException("javascriptStringArg unexpectedly null."); - } - Result resultCallback = new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String javascriptStringArg = (String) args.get(1); + if (javascriptStringArg == null) { + throw new NullPointerException("javascriptStringArg unexpectedly null."); + } + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.evaluateJavascript( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + javascriptStringArg, + resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getTitle", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getTitle", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String output = + api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollTo", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollTo", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number xArg = (Number)args.get(1); - if (xArg == null) { - throw new NullPointerException("xArg unexpectedly null."); - } - Number yArg = (Number)args.get(2); - if (yArg == null) { - throw new NullPointerException("yArg unexpectedly null."); - } - api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number xArg = (Number) args.get(1); + if (xArg == null) { + throw new NullPointerException("xArg unexpectedly null."); + } + Number yArg = (Number) args.get(2); + if (yArg == null) { + throw new NullPointerException("yArg unexpectedly null."); + } + api.scrollTo( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollBy", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.scrollBy", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number xArg = (Number)args.get(1); - if (xArg == null) { - throw new NullPointerException("xArg unexpectedly null."); - } - Number yArg = (Number)args.get(2); - if (yArg == null) { - throw new NullPointerException("yArg unexpectedly null."); - } - api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number xArg = (Number) args.get(1); + if (xArg == null) { + throw new NullPointerException("xArg unexpectedly null."); + } + Number yArg = (Number) args.get(2); + if (yArg == null) { + throw new NullPointerException("yArg unexpectedly null."); + } + api.scrollBy( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollX", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollX", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Long output = + api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollY", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollY", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Long output = + api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollPosition", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.getScrollPosition", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + WebViewPoint output = + api.getScrollPosition( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean enabledArg = (Boolean)args.get(0); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setWebContentsDebuggingEnabled(enabledArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean enabledArg = (Boolean) args.get(0); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setWebContentsDebuggingEnabled(enabledArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebViewClient", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebViewClient", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number webViewClientInstanceIdArg = (Number)args.get(1); - if (webViewClientInstanceIdArg == null) { - throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null."); - } - api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number webViewClientInstanceIdArg = (Number) args.get(1); + if (webViewClientInstanceIdArg == null) { + throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null."); + } + api.setWebViewClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewClientInstanceIdArg == null) + ? null + : webViewClientInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number javaScriptChannelInstanceIdArg = (Number)args.get(1); - if (javaScriptChannelInstanceIdArg == null) { - throw new NullPointerException("javaScriptChannelInstanceIdArg unexpectedly null."); - } - api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number javaScriptChannelInstanceIdArg = (Number) args.get(1); + if (javaScriptChannelInstanceIdArg == null) { + throw new NullPointerException( + "javaScriptChannelInstanceIdArg unexpectedly null."); + } + api.addJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number javaScriptChannelInstanceIdArg = (Number)args.get(1); - if (javaScriptChannelInstanceIdArg == null) { - throw new NullPointerException("javaScriptChannelInstanceIdArg unexpectedly null."); - } - api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number javaScriptChannelInstanceIdArg = (Number) args.get(1); + if (javaScriptChannelInstanceIdArg == null) { + throw new NullPointerException( + "javaScriptChannelInstanceIdArg unexpectedly null."); + } + api.removeJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number listenerInstanceIdArg = (Number)args.get(1); - api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number listenerInstanceIdArg = (Number) args.get(1); + api.setDownloadListener( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number clientInstanceIdArg = (Number)args.get(1); - api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number clientInstanceIdArg = (Number) args.get(1); + api.setWebChromeClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number colorArg = (Number)args.get(1); - if (colorArg == null) { - throw new NullPointerException("colorArg unexpectedly null."); - } - api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number colorArg = (Number) args.get(1); + if (colorArg == null) { + throw new NullPointerException("colorArg unexpectedly null."); + } + api.setBackgroundColor( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (colorArg == null) ? null : colorArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -1306,407 +1563,474 @@ public void error(Throwable error) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebSettingsHostApi { void create(@NonNull Long instanceId, @NonNull Long webViewInstanceId); + void setDomStorageEnabled(@NonNull Long instanceId, @NonNull Boolean flag); + void setJavaScriptCanOpenWindowsAutomatically(@NonNull Long instanceId, @NonNull Boolean flag); + void setSupportMultipleWindows(@NonNull Long instanceId, @NonNull Boolean support); + void setJavaScriptEnabled(@NonNull Long instanceId, @NonNull Boolean flag); + void setUserAgentString(@NonNull Long instanceId, @Nullable String userAgentString); + void setMediaPlaybackRequiresUserGesture(@NonNull Long instanceId, @NonNull Boolean require); + void setSupportZoom(@NonNull Long instanceId, @NonNull Boolean support); + void setLoadWithOverviewMode(@NonNull Long instanceId, @NonNull Boolean overview); + void setUseWideViewPort(@NonNull Long instanceId, @NonNull Boolean use); + void setDisplayZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled); + void setBuiltInZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled); + void setAllowFileAccess(@NonNull Long instanceId, @NonNull Boolean enabled); /** The codec used by WebSettingsHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, WebSettingsHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Number webViewInstanceIdArg = (Number)args.get(1); - if (webViewInstanceIdArg == null) { - throw new NullPointerException("webViewInstanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Number webViewInstanceIdArg = (Number) args.get(1); + if (webViewInstanceIdArg == null) { + throw new NullPointerException("webViewInstanceIdArg unexpectedly null."); + } + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean)args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean) args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setDomStorageEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean)args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean) args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setJavaScriptCanOpenWindowsAutomatically( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean supportArg = (Boolean)args.get(1); - if (supportArg == null) { - throw new NullPointerException("supportArg unexpectedly null."); - } - api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean supportArg = (Boolean) args.get(1); + if (supportArg == null) { + throw new NullPointerException("supportArg unexpectedly null."); + } + api.setSupportMultipleWindows( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean flagArg = (Boolean)args.get(1); - if (flagArg == null) { - throw new NullPointerException("flagArg unexpectedly null."); - } - api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean flagArg = (Boolean) args.get(1); + if (flagArg == null) { + throw new NullPointerException("flagArg unexpectedly null."); + } + api.setJavaScriptEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String userAgentStringArg = (String)args.get(1); - api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String userAgentStringArg = (String) args.get(1); + api.setUserAgentString( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + userAgentStringArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean requireArg = (Boolean)args.get(1); - if (requireArg == null) { - throw new NullPointerException("requireArg unexpectedly null."); - } - api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean requireArg = (Boolean) args.get(1); + if (requireArg == null) { + throw new NullPointerException("requireArg unexpectedly null."); + } + api.setMediaPlaybackRequiresUserGesture( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean supportArg = (Boolean)args.get(1); - if (supportArg == null) { - throw new NullPointerException("supportArg unexpectedly null."); - } - api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean supportArg = (Boolean) args.get(1); + if (supportArg == null) { + throw new NullPointerException("supportArg unexpectedly null."); + } + api.setSupportZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean overviewArg = (Boolean)args.get(1); - if (overviewArg == null) { - throw new NullPointerException("overviewArg unexpectedly null."); - } - api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean overviewArg = (Boolean) args.get(1); + if (overviewArg == null) { + throw new NullPointerException("overviewArg unexpectedly null."); + } + api.setLoadWithOverviewMode( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean useArg = (Boolean)args.get(1); - if (useArg == null) { - throw new NullPointerException("useArg unexpectedly null."); - } - api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean useArg = (Boolean) args.get(1); + if (useArg == null) { + throw new NullPointerException("useArg unexpectedly null."); + } + api.setUseWideViewPort( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean)args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean) args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setDisplayZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean)args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean) args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setBuiltInZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean enabledArg = (Boolean)args.get(1); - if (enabledArg == null) { - throw new NullPointerException("enabledArg unexpectedly null."); - } - api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean enabledArg = (Boolean) args.get(1); + if (enabledArg == null) { + throw new NullPointerException("enabledArg unexpectedly null."); + } + api.setAllowFileAccess( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -1719,35 +2043,41 @@ public interface JavaScriptChannelHostApi { /** The codec used by JavaScriptChannelHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, JavaScriptChannelHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - String channelNameArg = (String)args.get(1); - if (channelNameArg == null) { - throw new NullPointerException("channelNameArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + String channelNameArg = (String) args.get(1); + if (channelNameArg == null) { + throw new NullPointerException("channelNameArg unexpectedly null."); + } + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -1757,120 +2087,141 @@ static void setup(BinaryMessenger binaryMessenger, JavaScriptChannelHostApi api) /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaScriptChannelFlutterApi { private final BinaryMessenger binaryMessenger; - public JavaScriptChannelFlutterApi(BinaryMessenger argBinaryMessenger){ + + public JavaScriptChannelFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by JavaScriptChannelFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, Reply callback) { + + public void postMessage( + @NonNull Long instanceIdArg, @NonNull String messageArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, messageArg)), + channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); + + void setSynchronousReturnValueForShouldOverrideUrlLoading( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `WebViewClientHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, WebViewClientHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean valueArg = (Boolean)args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean valueArg = (Boolean) args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } + private static class WebViewClientFlutterApiCodec extends StandardMessageCodec { public static final WebViewClientFlutterApiCodec INSTANCE = new WebViewClientFlutterApiCodec(); + private WebViewClientFlutterApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return WebResourceErrorData.fromList((ArrayList) readValue(buffer)); - - case (byte)129: + + case (byte) 129: return WebResourceRequestData.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof WebResourceErrorData) { stream.write(128); writeValue(stream, ((WebResourceErrorData) value).toList()); - } else - if (value instanceof WebResourceRequestData) { + } else if (value instanceof WebResourceRequestData) { stream.write(129); writeValue(stream, ((WebResourceRequestData) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } @@ -1879,64 +2230,146 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewClientFlutterApi { private final BinaryMessenger binaryMessenger; - public WebViewClientFlutterApi(BinaryMessenger argBinaryMessenger){ + + public WebViewClientFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by WebViewClientFlutterApi. */ static MessageCodec getCodec() { - return WebViewClientFlutterApiCodec.INSTANCE; + return WebViewClientFlutterApiCodec.INSTANCE; } - public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { + + public void onPageStarted( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), + channelReply -> { + callback.reply(null); + }); } - public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { + + public void onPageFinished( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), + channelReply -> { + callback.reply(null); + }); } - public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, Reply callback) { + + public void onReceivedRequestError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull WebResourceErrorData errorArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + channelReply -> { + callback.reply(null); + }); } - public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, Reply callback) { + + public void onReceivedError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long errorCodeArg, + @NonNull String descriptionArg, + @NonNull String failingUrlArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + errorCodeArg, + descriptionArg, + failingUrlArg)), + channelReply -> { + callback.reply(null); + }); } - public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, Reply callback) { + + public void requestLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), + channelReply -> { + callback.reply(null); + }); } - public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, Reply callback) { + + public void urlLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), + channelReply -> { + callback.reply(null); + }); } - public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, Reply callback) { + + public void doUpdateVisitedHistory( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Boolean isReloadArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ @@ -1945,31 +2378,36 @@ public interface DownloadListenerHostApi { /** The codec used by DownloadListenerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `DownloadListenerHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, DownloadListenerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.DownloadListenerHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.DownloadListenerHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -1979,86 +2417,119 @@ static void setup(BinaryMessenger binaryMessenger, DownloadListenerHostApi api) /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class DownloadListenerFlutterApi { private final BinaryMessenger binaryMessenger; - public DownloadListenerFlutterApi(BinaryMessenger argBinaryMessenger){ + + public DownloadListenerFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by DownloadListenerFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, Reply callback) { + + public void onDownloadStart( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String userAgentArg, + @NonNull String contentDispositionArg, + @NonNull String mimetypeArg, + @NonNull Long contentLengthArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList( + instanceIdArg, + urlArg, + userAgentArg, + contentDispositionArg, + mimetypeArg, + contentLengthArg)), + channelReply -> { + callback.reply(null); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); + + void setSynchronousReturnValueForOnShowFileChooser( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `WebChromeClientHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, WebChromeClientHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - Boolean valueArg = (Boolean)args.get(1); - if (valueArg == null) { - throw new NullPointerException("valueArg unexpectedly null."); - } - api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + Boolean valueArg = (Boolean) args.get(1); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.setSynchronousReturnValueForOnShowFileChooser( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2067,62 +2538,73 @@ static void setup(BinaryMessenger binaryMessenger, WebChromeClientHostApi api) { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull List list(@NonNull String path); - @NonNull String getAssetFilePathByName(@NonNull String name); + @NonNull + List list(@NonNull String path); + + @NonNull + String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.list", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.list", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String pathArg = (String)args.get(0); - if (pathArg == null) { - throw new NullPointerException("pathArg unexpectedly null."); - } - List output = api.list(pathArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String pathArg = (String) args.get(0); + if (pathArg == null) { + throw new NullPointerException("pathArg unexpectedly null."); + } + List output = api.list(pathArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String nameArg = (String)args.get(0); - if (nameArg == null) { - throw new NullPointerException("nameArg unexpectedly null."); - } - String output = api.getAssetFilePathByName(nameArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String nameArg = (String) args.get(0); + if (nameArg == null) { + throw new NullPointerException("nameArg unexpectedly null."); + } + String output = api.getAssetFilePathByName(nameArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } @@ -2132,118 +2614,150 @@ static void setup(BinaryMessenger binaryMessenger, FlutterAssetManagerHostApi ap /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebChromeClientFlutterApi { private final BinaryMessenger binaryMessenger; - public WebChromeClientFlutterApi(BinaryMessenger argBinaryMessenger){ + + public WebChromeClientFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by WebChromeClientFlutterApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); + return new StandardMessageCodec(); } - public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, Reply callback) { + + public void onProgressChanged( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long progressArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", + getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), + channelReply -> { + callback.reply(null); + }); } - public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, Reply> callback) { + + public void onShowFileChooser( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long paramsInstanceIdArg, + Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebStorageHostApi { void create(@NonNull Long instanceId); + void deleteAllData(@NonNull Long instanceId); /** The codec used by WebStorageHostApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, WebStorageHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.create", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.create", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.deleteAllData", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebStorageHostApi.deleteAllData", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number instanceIdArg = (Number)args.get(0); - if (instanceIdArg == null) { - throw new NullPointerException("instanceIdArg unexpectedly null."); - } - api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number instanceIdArg = (Number) args.get(0); + if (instanceIdArg == null) { + throw new NullPointerException("instanceIdArg unexpectedly null."); + } + api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } + private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = + new FileChooserParamsFlutterApiCodec(); + private FileChooserParamsFlutterApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return FileChooserModeEnumData.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof FileChooserModeEnumData) { stream.write(128); writeValue(stream, ((FileChooserModeEnumData) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } @@ -2252,35 +2766,53 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) /** * Handles callbacks methods for the native Java FileChooserParams class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final BinaryMessenger binaryMessenger; - public FileChooserParamsFlutterApi(BinaryMessenger argBinaryMessenger){ + + public FileChooserParamsFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by FileChooserParamsFlutterApi. */ static MessageCodec getCodec() { - return FileChooserParamsFlutterApiCodec.INSTANCE; + return FileChooserParamsFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, Reply callback) { + + public void create( + @NonNull Long instanceIdArg, + @NonNull Boolean isCaptureEnabledArg, + @NonNull List acceptTypesArg, + @NonNull FileChooserModeEnumData modeArg, + @Nullable String filenameHintArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); - channel.send(new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); + channel.send( + new ArrayList( + Arrays.asList( + instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + channelReply -> { + callback.reply(null); + }); } } - @NonNull private static ArrayList wrapError(@NonNull Throwable exception) { + + @NonNull + private static ArrayList wrapError(@NonNull Throwable exception) { ArrayList errorList = new ArrayList<>(3); errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); - errorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + errorList.add( + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); return errorList; } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index dbe849a29017..5a947a3a0d47 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -19,10 +19,12 @@ 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. @@ -45,8 +47,7 @@ class FileChooserModeEnumData { static FileChooserModeEnumData decode(Object result) { result as List; return FileChooserModeEnumData( - value: FileChooserMode.values[result[0]! as int] -, + value: FileChooserMode.values[result[0]! as int], ); } } @@ -92,7 +93,8 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: (result[5] as Map?)!.cast(), + requestHeaders: + (result[5] as Map?)!.cast(), ); } } @@ -149,7 +151,6 @@ class WebViewPoint { } } - /// Handles methods calls to the native Java Object class. /// /// Also handles calls to remove the reference to an instance with `dispose`. @@ -188,7 +189,6 @@ class JavaObjectHostApi { } } - /// Handles callbacks methods for the native Java Object class. /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. @@ -197,7 +197,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -207,10 +208,11 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return; }); @@ -219,7 +221,6 @@ abstract class JavaObjectFlutterApi { } } - class CookieManagerHostApi { /// Constructor for [CookieManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -234,8 +235,7 @@ class CookieManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.clearCookies', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -295,13 +295,11 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -321,7 +319,8 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_useHybridComposition]) as List?; + await channel.send([arg_instanceId, arg_useHybridComposition]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -338,12 +337,14 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, + String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; + final List? replyList = await channel.send( + [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -360,12 +361,24 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { + Future loadDataWithBaseUrl( + int arg_instanceId, + String? arg_baseUrl, + String arg_data, + String? arg_mimeType, + String? arg_encoding, + String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; + final List? replyList = await channel.send([ + arg_instanceId, + arg_baseUrl, + arg_data, + arg_mimeType, + arg_encoding, + arg_historyUrl + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -382,12 +395,14 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, + Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -404,12 +419,13 @@ class WebViewHostApi { } } - Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl( + int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -573,7 +589,8 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -590,12 +607,14 @@ class WebViewHostApi { } } - Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript( + int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) as List?; + await channel.send([arg_instanceId, arg_javascriptString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -638,8 +657,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -660,8 +679,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -761,7 +780,8 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -781,12 +801,14 @@ class WebViewHostApi { } } - Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient( + int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_webViewClientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -803,12 +825,14 @@ class WebViewHostApi { } } - Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -825,12 +849,14 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -847,12 +873,14 @@ class WebViewHostApi { } } - Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener( + int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -869,12 +897,14 @@ class WebViewHostApi { } } - Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient( + int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -895,8 +925,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_color]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -914,7 +944,6 @@ class WebViewHostApi { } } - class WebSettingsHostApi { /// Constructor for [WebSettingsHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -930,7 +959,8 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -951,8 +981,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -969,12 +999,14 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically( + int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -991,12 +1023,14 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows( + int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1017,8 +1051,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1035,12 +1069,13 @@ class WebSettingsHostApi { } } - Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString( + int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1057,12 +1092,14 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture( + int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_require]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1083,8 +1120,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1101,12 +1138,13 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode( + int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_overview]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1127,8 +1165,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_use]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1145,12 +1183,13 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1167,12 +1206,13 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1193,8 +1233,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1212,7 +1252,6 @@ class WebSettingsHostApi { } } - class JavaScriptChannelHostApi { /// Constructor for [JavaScriptChannelHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1227,8 +1266,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1246,13 +1285,13 @@ class JavaScriptChannelHostApi { } } - abstract class JavaScriptChannelFlutterApi { static const MessageCodec codec = StandardMessageCodec(); void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1262,12 +1301,14 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null int.'); final String? arg_message = (args[1] as String?); - assert(arg_message != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null String.'); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null, expected non-null String.'); api.postMessage(arg_instanceId!, arg_message!); return; }); @@ -1276,7 +1317,6 @@ abstract class JavaScriptChannelFlutterApi { } } - class WebViewClientHostApi { /// Constructor for [WebViewClientHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1309,12 +1349,14 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1350,16 +1392,14 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return WebResourceRequestData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1371,17 +1411,22 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, + WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, + String description, String failingUrl); - void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading( + int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory( + int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1391,14 +1436,17 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null, expected non-null String.'); api.onPageStarted(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); @@ -1413,14 +1461,17 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null, expected non-null String.'); api.onPageFinished(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); @@ -1428,24 +1479,32 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); - assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); + final WebResourceErrorData? arg_error = + (args[3] as WebResourceErrorData?); + assert(arg_error != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, + arg_request!, arg_error!); return; }); } @@ -1459,19 +1518,25 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final int? arg_errorCode = (args[2] as int?); - assert(arg_errorCode != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); + assert(arg_errorCode != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null int.'); final String? arg_description = (args[3] as String?); - assert(arg_description != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); + assert(arg_description != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); final String? arg_failingUrl = (args[4] as String?); - assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); + assert(arg_failingUrl != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, + arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1485,15 +1550,20 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); + api.requestLoading( + arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1507,14 +1577,17 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null, expected non-null String.'); api.urlLoading(arg_instanceId!, arg_webViewInstanceId!, arg_url!); return; }); @@ -1522,24 +1595,30 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null String.'); final bool? arg_isReload = (args[3] as bool?); - assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + assert(arg_isReload != null, + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); + api.doUpdateVisitedHistory( + arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1547,7 +1626,6 @@ abstract class WebViewClientFlutterApi { } } - class DownloadListenerHostApi { /// Constructor for [DownloadListenerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1581,37 +1659,46 @@ class DownloadListenerHostApi { } } - abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, + String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_userAgent = (args[2] as String?); - assert(arg_userAgent != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_userAgent != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_contentDisposition = (args[3] as String?); - assert(arg_contentDisposition != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_contentDisposition != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final String? arg_mimetype = (args[4] as String?); - assert(arg_mimetype != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); + assert(arg_mimetype != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null String.'); final int? arg_contentLength = (args[5] as int?); - assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + assert(arg_contentLength != null, + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, + arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1619,7 +1706,6 @@ abstract class DownloadListenerFlutterApi { } } - class WebChromeClientHostApi { /// Constructor for [WebChromeClientHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1652,12 +1738,14 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1675,7 +1763,6 @@ class WebChromeClientHostApi { } } - class FlutterAssetManagerHostApi { /// Constructor for [FlutterAssetManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1715,7 +1802,8 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1741,55 +1829,66 @@ class FlutterAssetManagerHostApi { } } - abstract class WebChromeClientFlutterApi { static const MessageCodec codec = StandardMessageCodec(); void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser( + int instanceId, int webViewInstanceId, int paramsInstanceId); - static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); final int? arg_progress = (args[2] as int?); - assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + assert(arg_progress != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); + api.onProgressChanged( + arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); final int? arg_paramsInstanceId = (args[2] as int?); - assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + assert(arg_paramsInstanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); + final List output = await api.onShowFileChooser( + arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } @@ -1797,7 +1896,6 @@ abstract class WebChromeClientFlutterApi { } } - class WebStorageHostApi { /// Constructor for [WebStorageHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1868,13 +1966,11 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1883,11 +1979,14 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = + _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, + FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -1897,18 +1996,25 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null int.'); final bool? arg_isCaptureEnabled = (args[1] as bool?); - assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = (args[2] as List?)?.cast(); - assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); - assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); + assert(arg_isCaptureEnabled != null, + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); + final List? arg_acceptTypes = + (args[2] as List?)?.cast(); + assert(arg_acceptTypes != null, + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); + final FileChooserModeEnumData? arg_mode = + (args[3] as FileChooserModeEnumData?); + assert(arg_mode != null, + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, + arg_mode!, arg_filenameHint); return; }); } 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 46c0f9068d63..1bf190a6938e 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 @@ -440,7 +440,7 @@ void main() { test('onUrlChange', () { final AndroidNavigationDelegate androidNavigationDelegate = - AndroidNavigationDelegate(_buildCreationParams()); + AndroidNavigationDelegate(_buildCreationParams()); late final UrlChange urlChange; androidNavigationDelegate diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index cc0e22645e3f..56ba79a66622 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -13,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:webview_flutter_android/src/android_webview.g.dart'; - /// Handles methods calls to the native Java Object class. /// /// Also handles calls to remove the reference to an instance with `dispose`. @@ -24,7 +23,8 @@ abstract class TestJavaObjectHostApi { void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, @@ -34,10 +34,11 @@ abstract class TestJavaObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return []; }); @@ -61,13 +62,11 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -77,9 +76,11 @@ abstract class TestWebViewHostApi { void create(int instanceId, bool useHybridComposition); - void loadData(int instanceId, String data, String? mimeType, String? encoding); + void loadData( + int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, + String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -127,7 +128,8 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, @@ -137,12 +139,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null int.'); final bool? arg_useHybridComposition = (args[1] as bool?); - assert(arg_useHybridComposition != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null bool.'); + assert(arg_useHybridComposition != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null, expected non-null bool.'); api.create(arg_instanceId!, arg_useHybridComposition!); return []; }); @@ -157,12 +161,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null int.'); final String? arg_data = (args[1] as String?); - assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.'); + assert(arg_data != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.'); final String? arg_mimeType = (args[2] as String?); final String? arg_encoding = (args[3] as String?); api.loadData(arg_instanceId!, arg_data!, arg_mimeType, arg_encoding); @@ -179,17 +185,20 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null int.'); final String? arg_baseUrl = (args[1] as String?); final String? arg_data = (args[2] as String?); - assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.'); + assert(arg_data != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.'); final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, + arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -203,14 +212,18 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = (args[2] as Map?)?.cast(); - assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); + final Map? arg_headers = + (args[2] as Map?)?.cast(); + assert(arg_headers != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); return []; }); @@ -225,14 +238,17 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null String.'); final Uint8List? arg_data = (args[2] as Uint8List?); - assert(arg_data != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null Uint8List.'); + assert(arg_data != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null, expected non-null Uint8List.'); api.postUrl(arg_instanceId!, arg_url!, arg_data!); return []; }); @@ -247,10 +263,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return [output]; }); @@ -265,10 +282,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return [output]; }); @@ -283,10 +301,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return [output]; }); @@ -301,10 +320,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return []; }); @@ -319,10 +339,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return []; }); @@ -337,10 +358,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return []; }); @@ -355,12 +377,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null int.'); final bool? arg_includeDiskFiles = (args[1] as bool?); - assert(arg_includeDiskFiles != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null bool.'); + assert(arg_includeDiskFiles != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null, expected non-null bool.'); api.clearCache(arg_instanceId!, arg_includeDiskFiles!); return []; }); @@ -375,13 +399,16 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null int.'); final String? arg_javascriptString = (args[1] as String?); - assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); + assert(arg_javascriptString != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); + final String? output = await api.evaluateJavascript( + arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -395,10 +422,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return [output]; }); @@ -413,14 +441,17 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); final int? arg_x = (args[1] as int?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); final int? arg_y = (args[2] as int?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null, expected non-null int.'); api.scrollTo(arg_instanceId!, arg_x!, arg_y!); return []; }); @@ -435,14 +466,17 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); final int? arg_x = (args[1] as int?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); final int? arg_y = (args[2] as int?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null, expected non-null int.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return []; }); @@ -457,10 +491,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null, expected non-null int.'); final int output = api.getScrollX(arg_instanceId!); return [output]; }); @@ -475,10 +510,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null, expected non-null int.'); final int output = api.getScrollY(arg_instanceId!); return [output]; }); @@ -493,10 +529,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null, expected non-null int.'); final WebViewPoint output = api.getScrollPosition(arg_instanceId!); return [output]; }); @@ -504,17 +541,19 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null, expected non-null bool.'); api.setWebContentsDebuggingEnabled(arg_enabled!); return []; }); @@ -529,12 +568,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); final int? arg_webViewClientInstanceId = (args[1] as int?); - assert(arg_webViewClientInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); + assert(arg_webViewClientInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null, expected non-null int.'); api.setWebViewClient(arg_instanceId!, arg_webViewClientInstanceId!); return []; }); @@ -549,13 +590,16 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); final int? arg_javaScriptChannelInstanceId = (args[1] as int?); - assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + assert(arg_javaScriptChannelInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); + api.addJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -569,13 +613,16 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); final int? arg_javaScriptChannelInstanceId = (args[1] as int?); - assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + assert(arg_javaScriptChannelInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); + api.removeJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -589,10 +636,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.'); final int? arg_listenerInstanceId = (args[1] as int?); api.setDownloadListener(arg_instanceId!, arg_listenerInstanceId); return []; @@ -608,10 +656,11 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.'); final int? arg_clientInstanceId = (args[1] as int?); api.setWebChromeClient(arg_instanceId!, arg_clientInstanceId); return []; @@ -627,12 +676,14 @@ abstract class TestWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_color = (args[1] as int?); - assert(arg_color != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_color != null, + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null, expected non-null int.'); api.setBackgroundColor(arg_instanceId!, arg_color!); return []; }); @@ -641,7 +692,6 @@ abstract class TestWebViewHostApi { } } - abstract class TestWebSettingsHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -671,7 +721,8 @@ abstract class TestWebSettingsHostApi { void setAllowFileAccess(int instanceId, bool enabled); - static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, @@ -681,12 +732,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_webViewInstanceId!); return []; }); @@ -701,12 +754,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null bool.'); + assert(arg_flag != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null, expected non-null bool.'); api.setDomStorageEnabled(arg_instanceId!, arg_flag!); return []; }); @@ -714,39 +769,46 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); + assert(arg_flag != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); + api.setJavaScriptCanOpenWindowsAutomatically( + arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null int.'); final bool? arg_support = (args[1] as bool?); - assert(arg_support != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null bool.'); + assert(arg_support != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null, expected non-null bool.'); api.setSupportMultipleWindows(arg_instanceId!, arg_support!); return []; }); @@ -761,12 +823,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_flag = (args[1] as bool?); - assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_flag != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_flag!); return []; }); @@ -781,10 +845,11 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null int.'); final String? arg_userAgentString = (args[1] as String?); api.setUserAgentString(arg_instanceId!, arg_userAgentString); return []; @@ -793,20 +858,24 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null int.'); final bool? arg_require = (args[1] as bool?); - assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); + assert(arg_require != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); + api.setMediaPlaybackRequiresUserGesture( + arg_instanceId!, arg_require!); return []; }); } @@ -820,12 +889,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null int.'); final bool? arg_support = (args[1] as bool?); - assert(arg_support != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null bool.'); + assert(arg_support != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null, expected non-null bool.'); api.setSupportZoom(arg_instanceId!, arg_support!); return []; }); @@ -833,19 +904,22 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null int.'); final bool? arg_overview = (args[1] as bool?); - assert(arg_overview != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null bool.'); + assert(arg_overview != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null, expected non-null bool.'); api.setLoadWithOverviewMode(arg_instanceId!, arg_overview!); return []; }); @@ -860,12 +934,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null int.'); final bool? arg_use = (args[1] as bool?); - assert(arg_use != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null bool.'); + assert(arg_use != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null, expected non-null bool.'); api.setUseWideViewPort(arg_instanceId!, arg_use!); return []; }); @@ -880,12 +956,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null, expected non-null bool.'); api.setDisplayZoomControls(arg_instanceId!, arg_enabled!); return []; }); @@ -900,12 +978,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null, expected non-null bool.'); api.setBuiltInZoomControls(arg_instanceId!, arg_enabled!); return []; }); @@ -920,12 +1000,14 @@ abstract class TestWebSettingsHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null, expected non-null bool.'); api.setAllowFileAccess(arg_instanceId!, arg_enabled!); return []; }); @@ -934,13 +1016,13 @@ abstract class TestWebSettingsHostApi { } } - abstract class TestJavaScriptChannelHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, @@ -950,12 +1032,14 @@ abstract class TestJavaScriptChannelHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null int.'); final String? arg_channelName = (args[1] as String?); - assert(arg_channelName != null, 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null String.'); + assert(arg_channelName != null, + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null, expected non-null String.'); api.create(arg_instanceId!, arg_channelName!); return []; }); @@ -964,15 +1048,16 @@ abstract class TestJavaScriptChannelHostApi { } } - abstract class TestWebViewClientHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, @@ -982,10 +1067,11 @@ abstract class TestWebViewClientHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -993,20 +1079,24 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null int.'); final bool? arg_value = (args[1] as bool?); - assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + arg_instanceId!, arg_value!); return []; }); } @@ -1014,13 +1104,13 @@ abstract class TestWebViewClientHostApi { } } - abstract class TestDownloadListenerHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, @@ -1030,10 +1120,11 @@ abstract class TestDownloadListenerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1042,15 +1133,16 @@ abstract class TestDownloadListenerHostApi { } } - abstract class TestWebChromeClientHostApi { static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser( + int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, @@ -1060,10 +1152,11 @@ abstract class TestWebChromeClientHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1071,20 +1164,24 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null int.'); final bool? arg_value = (args[1] as bool?); - assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); + api.setSynchronousReturnValueForOnShowFileChooser( + arg_instanceId!, arg_value!); return []; }); } @@ -1092,7 +1189,6 @@ abstract class TestWebChromeClientHostApi { } } - abstract class TestAssetManagerHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -1100,7 +1196,8 @@ abstract class TestAssetManagerHostApi { String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, @@ -1110,10 +1207,11 @@ abstract class TestAssetManagerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); - assert(arg_path != null, 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null, expected non-null String.'); + assert(arg_path != null, + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null, expected non-null String.'); final List output = api.list(arg_path!); return [output]; }); @@ -1121,17 +1219,19 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null, expected non-null String.'); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null, expected non-null String.'); final String output = api.getAssetFilePathByName(arg_name!); return [output]; }); @@ -1140,7 +1240,6 @@ abstract class TestAssetManagerHostApi { } } - abstract class TestWebStorageHostApi { static const MessageCodec codec = StandardMessageCodec(); @@ -1148,7 +1247,8 @@ abstract class TestWebStorageHostApi { void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, @@ -1158,10 +1258,11 @@ abstract class TestWebStorageHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return []; }); @@ -1176,10 +1277,11 @@ abstract class TestWebStorageHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null, expected non-null int.'); api.deleteAllData(arg_instanceId!); return []; }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index c11495d52bac..35bcc869d247 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.2.0 + +* Adds support for `PlatformNavigationDelegate.onUrlChange`. + ## 3.1.1 * Updates links for the merge of flutter/plugins into flutter/packages. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart index 16411b8140a5..4beca15ff561 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart @@ -1002,6 +1002,42 @@ Future main() async { final String? currentUrl = await controller.currentUrl(); expect(currentUrl, secondaryUrl); }); + + testWidgets('can receive url changes', (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + )..setOnPageFinished((_) => pageLoaded.complete()); + + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ) + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setPlatformNavigationDelegate(navigationDelegate) + ..loadRequest(LoadRequestParams(uri: Uri.parse(blankPageEncoded))); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await pageLoaded.future; + await navigationDelegate.setOnPageFinished((_) {}); + + final Completer urlChangeCompleter = Completer(); + await navigationDelegate.setOnUrlChange((UrlChange change) { + urlChangeCompleter.complete(change.url); + }); + + await controller.runJavaScript('location.href = "$primaryUrl"'); + + await expectLater(urlChangeCompleter.future, completion(primaryUrl)); + }); }); testWidgets('launches with gestureNavigationEnabled on iOS', diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 9e1038d08279..19e2b39a5c12 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 8F4FF949299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF948299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m */; }; + 8F4FF94B29AC223F000A6586 /* FWFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */; }; 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */; }; 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */; }; 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */; }; @@ -78,6 +79,7 @@ 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 8F4FF948299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewFlutterWKWebViewExternalAPITests.m; sourceTree = ""; }; + 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFURLTests.m; sourceTree = ""; }; 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFInstanceManagerTests.m; sourceTree = ""; }; 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewHostApiTests.m; sourceTree = ""; }; 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFDataConvertersTests.m; sourceTree = ""; }; @@ -162,6 +164,7 @@ 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */, 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */, 8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */, + 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -463,6 +466,7 @@ buildActionMask = 2147483647; files = ( 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */, + 8F4FF94B29AC223F000A6586 /* FWFURLTests.m in Sources */, 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */, 8FB79B972821985200C101D3 /* FWFObjectHostApiTests.m in Sources */, 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist index bea41604e8aa..6ee44fd0e2fd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist @@ -43,5 +43,7 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m index b8e41d142331..888a3a1e9a66 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -139,7 +139,43 @@ - (void)testObserveValueForKeyPath { return value[0].value == FWFNSKeyValueChangeKeyEnumOldValue; }] changeValues:[OCMArg checkWithBlock:^BOOL(id value) { - return [@"key" isEqual:value[0]]; + FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; + return !object.isIdentifier.boolValue && + [@"key" isEqual:object.value]; + }] + completion:OCMOCK_ANY]); +} + +- (void)testObserveValueForKeyPathWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + + FWFObject *mockObject = [self mockObjectWithManager:instanceManager identifier:0]; + FWFObjectFlutterApiImpl *mockFlutterAPI = [self mockFlutterApiWithManager:instanceManager]; + + OCMStub([mockObject objectApi]).andReturn(mockFlutterAPI); + + NSObject *object = [[NSObject alloc] init]; + [instanceManager addDartCreatedInstance:object withIdentifier:1]; + + NSObject *returnedObject = [[NSObject alloc] init]; + [instanceManager addDartCreatedInstance:returnedObject withIdentifier:2]; + + [mockObject observeValueForKeyPath:@"keyPath" + ofObject:object + change:@{NSKeyValueChangeOldKey : returnedObject} + context:nil]; + OCMVerify([mockFlutterAPI + observeValueForObjectWithIdentifier:@0 + keyPath:@"keyPath" + objectIdentifier:@1 + changeKeys:[OCMArg checkWithBlock:^BOOL( + NSArray + *value) { + return value[0].value == FWFNSKeyValueChangeKeyEnumOldValue; + }] + changeValues:[OCMArg checkWithBlock:^BOOL(id value) { + FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; + return object.isIdentifier.boolValue && [@(2) isEqual:object.value]; }] completion:OCMOCK_ANY]); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m new file mode 100644 index 000000000000..9f5c58e917b4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m @@ -0,0 +1,48 @@ +// Copyright 2013 The Flutter Authors. 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; +@import webview_flutter_wkwebview; + +#import + +@interface FWFURLTests : XCTestCase +@end + +@implementation FWFURLTests +- (void)testAbsoluteString { + NSURL *mockUrl = OCMClassMock([NSURL class]); + OCMStub([mockUrl absoluteString]).andReturn(@"https://www.google.com"); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addDartCreatedInstance:mockUrl withIdentifier:0]; + + FWFURLHostApiImpl *hostApi = [[FWFURLHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + FlutterError *error; + XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:@(0) error:&error], + @"https://www.google.com"); + XCTAssertNil(error); +} + +- (void)testFlutterApiCreate { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFURLFlutterApiImpl *flutterApi = [[FWFURLFlutterApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + + flutterApi.api = OCMClassMock([FWFNSUrlFlutterApi class]); + + NSURL *url = [[NSURL alloc] initWithString:@"https://www.google.com"]; + [flutterApi create:url + completion:^(NSError *error){ + }]; + + long identifier = [instanceManager identifierWithStrongReferenceForInstance:url]; + OCMVerify([flutterApi.api createWithIdentifier:@(identifier) completion:OCMOCK_ANY]); +} +@end 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 aef7ece0c2e3..93d39ef2c78a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart @@ -124,6 +124,9 @@ Page resource error: } debugPrint('allowing navigation to ${request.url}'); return NavigationDecision.navigate; + }) + ..setOnUrlChange((UrlChange change) { + debugPrint('url change to ${change.url}'); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml index 718eb282018b..fdd941c1ea65 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml @@ -34,3 +34,11 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css + + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_platform_interface: + path: ../../../webview_flutter/webview_flutter_platform_interface + webview_flutter_wkwebview: + path: ../../../webview_flutter/webview_flutter_wkwebview \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m index 5795018b2043..0c456a54a778 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m @@ -13,6 +13,7 @@ #import "FWFScrollViewHostApi.h" #import "FWFUIDelegateHostApi.h" #import "FWFUIViewHostApi.h" +#import "FWFURLHostApi.h" #import "FWFUserContentControllerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" #import "FWFWebViewHostApi.h" @@ -100,6 +101,9 @@ + (void)registerWithRegistrar:(NSObject *)registrar { FWFWKWebViewHostApiSetup(registrar.messenger, [[FWFWebViewHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); + FWFNSUrlHostApiSetup(registrar.messenger, + [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger + instanceManager:instanceManager]); FWFWebViewFactory *webviewFactory = [[FWFWebViewFactory alloc] initWithManager:instanceManager]; [registrar registerViewFactory:webviewFactory withId:@"plugins.flutter.io/webview"]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h index cc41f4c15040..75ff9111f285 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -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 (v4.2.13), do not edit directly. +// Autogenerated from Pigeon (v4.2.14), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; @@ -13,8 +13,7 @@ NS_ASSUME_NONNULL_BEGIN /// Mirror of NSKeyValueObservingOptions. /// -/// See -/// https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. +/// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumNewValue = 0, FWFNSKeyValueObservingOptionsEnumOldValue = 1, @@ -53,8 +52,7 @@ typedef NS_ENUM(NSUInteger, FWFWKUserScriptInjectionTimeEnum) { /// Mirror of WKAudiovisualMediaTypes. /// -/// See -/// [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). +/// See [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumNone = 0, FWFWKAudiovisualMediaTypeEnumAudio = 1, @@ -64,8 +62,7 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { /// Mirror of WKWebsiteDataTypes. /// -/// See -/// https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. +/// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumCookies = 0, FWFWKWebsiteDataTypeEnumMemoryCache = 1, @@ -108,38 +105,31 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// An object that contains information about an action that causes navigation /// to occur. /// -/// Wraps -/// [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +/// Wraps [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// A link activation. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. FWFWKNavigationTypeLinkActivated = 0, /// A request to submit a form. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. FWFWKNavigationTypeSubmitted = 1, /// A request for the frame’s next or previous item. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. FWFWKNavigationTypeBackForward = 2, /// A request to reload the webpage. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. FWFWKNavigationTypeReload = 3, /// A request to resubmit a form. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. FWFWKNavigationTypeFormResubmitted = 4, /// A navigation request that originates for some other reason. /// - /// See - /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. + /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. FWFWKNavigationTypeOther = 5, }; @@ -157,6 +147,7 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { @class FWFNSErrorData; @class FWFWKScriptMessageData; @class FWFNSHttpCookieData; +@class FWFObjectOrIdentifier; @interface FWFNSKeyValueObservingOptionsEnumData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. @@ -214,13 +205,13 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString *url; -@property(nonatomic, copy, nullable) NSString *httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString * url; +@property(nonatomic, copy, nullable) NSString * httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; +@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; @end /// Mirror of WKUserScript. @@ -230,11 +221,11 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString *source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString * source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; +@property(nonatomic, strong) NSNumber * isMainFrameOnly; @end /// Mirror of WKNavigationAction. @@ -244,10 +235,10 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame - navigationType:(FWFWKNavigationType)navigationType; -@property(nonatomic, strong) FWFNSUrlRequestData *request; -@property(nonatomic, strong) FWFWKFrameInfoData *targetFrame; + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType; +@property(nonatomic, strong) FWFNSUrlRequestData * request; +@property(nonatomic, strong) FWFWKFrameInfoData * targetFrame; @property(nonatomic, assign) FWFWKNavigationType navigationType; @end @@ -258,7 +249,7 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber *isMainFrame; +@property(nonatomic, strong) NSNumber * isMainFrame; @end /// Mirror of NSError. @@ -268,11 +259,11 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription; -@property(nonatomic, strong) NSNumber *code; -@property(nonatomic, copy) NSString *domain; -@property(nonatomic, copy) NSString *localizedDescription; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription; +@property(nonatomic, strong) NSNumber * code; +@property(nonatomic, copy) NSString * domain; +@property(nonatomic, copy) NSString * localizedDescription; @end /// Mirror of WKScriptMessage. @@ -281,9 +272,10 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name body:(id)body; -@property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) id body; ++ (instancetype)makeWithName:(NSString *)name + body:(id )body; +@property(nonatomic, copy) NSString * name; +@property(nonatomic, strong) id body; @end /// Mirror of NSHttpCookieData. @@ -293,9 +285,23 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray *propertyKeys; -@property(nonatomic, strong) NSArray *propertyValues; + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray * propertyKeys; +@property(nonatomic, strong) NSArray * propertyValues; +@end + +/// An object that can represent either a value supported by +/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier +/// of an object stored in an `InstanceManager`. +@interface FWFObjectOrIdentifier : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)makeWithValue:(id )value + isIdentifier:(NSNumber *)isIdentifier; +@property(nonatomic, strong) id value; +/// Whether value is an int that is used to retrieve an instance stored in an +/// `InstanceManager`. +@property(nonatomic, strong) NSNumber * isIdentifier; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. @@ -305,21 +311,12 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier - ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch - completion:(void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion; -@end - -extern void FWFWKWebsiteDataStoreHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +@end + +extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @@ -328,16 +325,11 @@ NSObject *FWFUIViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier - toValue:(nullable NSNumber *)value - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier - isOpaque:(NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @@ -346,25 +338,14 @@ NSObject *FWFUIScrollViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier - x:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @@ -374,28 +355,12 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier - forTypes: - (NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - error: - (FlutterError *_Nullable *_Nonnull) - error; -@end - -extern void FWFWKWebViewConfigurationHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationFlutterApi. NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void); @@ -405,8 +370,7 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier - completion:(void (^)(NSError *_Nullable))completion; +- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @@ -415,31 +379,15 @@ NSObject *FWFWKUserContentControllerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - handlerIdentifier:(NSNumber *)handlerIdentifier - ofName:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - name:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier - userScript:(FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFWKUserContentControllerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier handlerIdentifier:(NSNumber *)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @@ -448,16 +396,11 @@ NSObject *FWFWKPreferencesHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier - isEnabled:(NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -469,9 +412,7 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerFlutterApi. NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void); @@ -481,10 +422,7 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier - userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier - message:(FWFWKScriptMessageData *)message - completion:(void (^)(NSError *_Nullable))completion; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @@ -496,9 +434,7 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @@ -508,37 +444,12 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - URL:(nullable NSString *)url - completion:(void (^)(NSError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - URL:(nullable NSString *)url - completion: - (void (^)(NSError *_Nullable))completion; -- (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - navigationAction: - (FWFWKNavigationActionData *)navigationAction - completion: - (void (^)(FWFWKNavigationActionPolicyEnumData - *_Nullable, - NSError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FWFNSErrorData *)error - completion:(void (^)(NSError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FWFNSErrorData *)error - completion: - (void (^)(NSError *_Nullable))completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - completion:(void (^)(NSError *_Nullable)) - completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion; +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @@ -547,22 +458,12 @@ NSObject *FWFNSObjectHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/objectivec/nsobject. @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier - keyPath:(NSString *)keyPath - options: - (NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier - keyPath:(NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. NSObject *FWFNSObjectFlutterApiGetCodec(void); @@ -572,14 +473,8 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/objectivec/nsobject. @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier - keyPath:(NSString *)keyPath - objectIdentifier:(NSNumber *)objectIdentifier - changeKeys:(NSArray *)changeKeys - changeValues:(NSArray *)changeValues - completion:(void (^)(NSError *_Nullable))completion; -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier - completion:(void (^)(NSError *_Nullable))completion; +- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier keyPath:(NSString *)keyPath objectIdentifier:(NSNumber *)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void(^)(NSError *_Nullable))completion; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @@ -588,65 +483,30 @@ NSObject *FWFWKWebViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier - delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier - delegateIdentifier: - (nullable NSNumber *)navigationDelegateIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier - request:(FWFNSUrlRequestData *)request - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier - HTMLString:(NSString *)string - baseURL:(nullable NSString *)baseUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier - fileURL:(NSString *)url - readAccessURL:(NSString *)readAccessUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier - assetKey:(NSString *)key - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier - error: - (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier - javaScriptString:(NSString *)javaScriptString - completion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; -@end - -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; +@end + +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -658,8 +518,7 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); @@ -669,11 +528,7 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - configurationIdentifier:(NSNumber *)configurationIdentifier - navigationAction:(FWFWKNavigationActionData *)navigationAction - completion:(void (^)(NSError *_Nullable))completion; +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier configurationIdentifier:(NSNumber *)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @@ -682,15 +537,40 @@ NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier - dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier - cookie:(FWFNSHttpCookieData *)cookie - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); + +/// The codec used by FWFNSUrlHostApi. +NSObject *FWFNSUrlHostApiGetCodec(void); + +/// Host API for `NSUrl`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +@protocol FWFNSUrlHostApi +- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +@end +extern void FWFNSUrlHostApiSetup(id binaryMessenger, NSObject *_Nullable api); + +/// The codec used by FWFNSUrlFlutterApi. +NSObject *FWFNSUrlFlutterApiGetCodec(void); + +/// Flutter API for `NSUrl`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +@interface FWFNSUrlFlutterApi : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +@end NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index b2a365b038c3..6cf05cb5bad8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -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 (v4.2.13), do not edit directly. +// Autogenerated from Pigeon (v4.2.14), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "FWFGeneratedWebKitApis.h" #import @@ -12,17 +12,20 @@ static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - return @[ - error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] - ]; + return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] ]; } - return @[ result ?: [NSNull null] ]; + return @[ result ?: [NSNull null] ]; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { +static id GetNullableObject(NSDictionary* dict, id key) { + id result = dict[key]; + return (result == [NSNull null]) ? nil : result; +} +static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } + @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list; + (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list; @@ -93,23 +96,24 @@ + (FWFNSHttpCookieData *)fromList:(NSArray *)list; + (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end +@interface FWFObjectOrIdentifier () ++ (FWFObjectOrIdentifier *)fromList:(NSArray *)list; ++ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; +@end @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSKeyValueObservingOptionsEnumData fromList:list] : nil; -} ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSKeyValueObservingOptionsEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -119,7 +123,7 @@ - (NSArray *)toList { @implementation FWFNSKeyValueChangeKeyEnumData + (instancetype)makeWithValue:(FWFNSKeyValueChangeKeyEnum)value { - FWFNSKeyValueChangeKeyEnumData *pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; + FWFNSKeyValueChangeKeyEnumData* pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -128,9 +132,7 @@ + (FWFNSKeyValueChangeKeyEnumData *)fromList:(NSArray *)list { pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSKeyValueChangeKeyEnumData fromList:list] : nil; -} ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSKeyValueChangeKeyEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -140,20 +142,16 @@ - (NSArray *)toList { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromList:(NSArray *)list { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKUserScriptInjectionTimeEnumData fromList:list] : nil; -} ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKUserScriptInjectionTimeEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -163,20 +161,16 @@ - (NSArray *)toList { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromList:(NSArray *)list { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKAudiovisualMediaTypeEnumData fromList:list] : nil; -} ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKAudiovisualMediaTypeEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -186,7 +180,7 @@ - (NSArray *)toList { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -195,9 +189,7 @@ + (FWFWKWebsiteDataTypeEnumData *)fromList:(NSArray *)list { pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKWebsiteDataTypeEnumData fromList:list] : nil; -} ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKWebsiteDataTypeEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -207,20 +199,16 @@ - (NSArray *)toList { @implementation FWFWKNavigationActionPolicyEnumData + (instancetype)makeWithValue:(FWFWKNavigationActionPolicyEnum)value { - FWFWKNavigationActionPolicyEnumData *pigeonResult = - [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData* pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKNavigationActionPolicyEnumData *)fromList:(NSArray *)list { - FWFWKNavigationActionPolicyEnumData *pigeonResult = - [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKNavigationActionPolicyEnumData fromList:list] : nil; -} ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKNavigationActionPolicyEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -230,20 +218,16 @@ - (NSArray *)toList { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromList:(NSArray *)list { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSHttpCookiePropertyKeyEnumData fromList:list] : nil; -} ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSHttpCookiePropertyKeyEnumData fromList:list] : nil; } - (NSArray *)toList { return @[ @(self.value), @@ -253,10 +237,10 @@ - (NSArray *)toList { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -273,9 +257,7 @@ + (FWFNSUrlRequestData *)fromList:(NSArray *)list { NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } -+ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSUrlRequestData fromList:list] : nil; -} ++ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSUrlRequestData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.url ?: [NSNull null]), @@ -288,9 +270,9 @@ - (NSArray *)toList { @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -300,15 +282,12 @@ + (FWFWKUserScriptData *)fromList:(NSArray *)list { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = - [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; + pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; pigeonResult.isMainFrameOnly = GetNullableObjectAtIndex(list, 2); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } -+ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKUserScriptData fromList:list] : nil; -} ++ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKUserScriptData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.source ?: [NSNull null]), @@ -320,9 +299,9 @@ - (NSArray *)toList { @implementation FWFWKNavigationActionData + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame - navigationType:(FWFWKNavigationType)navigationType { - FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType { + FWFWKNavigationActionData* pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = request; pigeonResult.targetFrame = targetFrame; pigeonResult.navigationType = navigationType; @@ -332,15 +311,12 @@ + (FWFWKNavigationActionData *)fromList:(NSArray *)list { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 0))]; NSAssert(pigeonResult.request != nil, @""); - pigeonResult.targetFrame = - [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; + pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; NSAssert(pigeonResult.targetFrame != nil, @""); pigeonResult.navigationType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKNavigationActionData fromList:list] : nil; -} ++ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKNavigationActionData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.request ? [self.request toList] : [NSNull null]), @@ -352,7 +328,7 @@ - (NSArray *)toList { @implementation FWFWKFrameInfoData + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { - FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; + FWFWKFrameInfoData* pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } @@ -362,9 +338,7 @@ + (FWFWKFrameInfoData *)fromList:(NSArray *)list { NSAssert(pigeonResult.isMainFrame != nil, @""); return pigeonResult; } -+ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKFrameInfoData fromList:list] : nil; -} ++ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKFrameInfoData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.isMainFrame ?: [NSNull null]), @@ -374,9 +348,9 @@ - (NSArray *)toList { @implementation FWFNSErrorData + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription { - FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription { + FWFNSErrorData* pigeonResult = [[FWFNSErrorData alloc] init]; pigeonResult.code = code; pigeonResult.domain = domain; pigeonResult.localizedDescription = localizedDescription; @@ -392,9 +366,7 @@ + (FWFNSErrorData *)fromList:(NSArray *)list { NSAssert(pigeonResult.localizedDescription != nil, @""); return pigeonResult; } -+ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSErrorData fromList:list] : nil; -} ++ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSErrorData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.code ?: [NSNull null]), @@ -405,8 +377,9 @@ - (NSArray *)toList { @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name body:(id)body { - FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; ++ (instancetype)makeWithName:(NSString *)name + body:(id )body { + FWFWKScriptMessageData* pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; return pigeonResult; @@ -418,9 +391,7 @@ + (FWFWKScriptMessageData *)fromList:(NSArray *)list { pigeonResult.body = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -+ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFWKScriptMessageData fromList:list] : nil; -} ++ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKScriptMessageData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.name ?: [NSNull null]), @@ -431,8 +402,8 @@ - (NSArray *)toList { @implementation FWFNSHttpCookieData + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues { - FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = propertyKeys; pigeonResult.propertyValues = propertyValues; return pigeonResult; @@ -445,9 +416,7 @@ + (FWFNSHttpCookieData *)fromList:(NSArray *)list { NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } -+ (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list { - return (list) ? [FWFNSHttpCookieData fromList:list] : nil; -} ++ (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSHttpCookieData fromList:list] : nil; } - (NSArray *)toList { return @[ (self.propertyKeys ?: [NSNull null]), @@ -456,16 +425,42 @@ - (NSArray *)toList { } @end +@implementation FWFObjectOrIdentifier ++ (instancetype)makeWithValue:(id )value + isIdentifier:(NSNumber *)isIdentifier { + FWFObjectOrIdentifier* pigeonResult = [[FWFObjectOrIdentifier alloc] init]; + pigeonResult.value = value; + pigeonResult.isIdentifier = isIdentifier; + return pigeonResult; +} ++ (FWFObjectOrIdentifier *)fromList:(NSArray *)list { + FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init]; + pigeonResult.value = GetNullableObjectAtIndex(list, 0); + pigeonResult.isIdentifier = GetNullableObjectAtIndex(list, 1); + NSAssert(pigeonResult.isIdentifier != nil, @""); + return pigeonResult; +} ++ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list { return (list) ? [FWFObjectOrIdentifier fromList:list] : nil; } +- (NSArray *)toList { + return @[ + (self.value ?: [NSNull null]), + (self.isIdentifier ?: [NSNull null]), + ]; +} +@end + @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -473,11 +468,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -494,56 +491,47 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKWebsiteDataStoreHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDefaultDataStoreWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -551,36 +539,30 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_identifier - ofTypes:arg_dataTypes - modifiedSince:arg_modificationTimeInSecondsSinceEpoch - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -591,19 +573,15 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: - toValue:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -612,20 +590,19 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -634,7 +611,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -645,65 +623,56 @@ void FWFUIViewHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier - webViewIdentifier:arg_webViewIdentifier - error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier - error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(scrollByForScrollViewWithIdentifier:x:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -713,34 +682,30 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_identifier - toX:arg_x - y:arg_y - error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -748,13 +713,15 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -762,11 +729,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -783,29 +752,26 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKWebViewConfigurationHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -813,87 +779,71 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier - webViewIdentifier:arg_webViewIdentifier - error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier - isAllowed:arg_allow - error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." - @"setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: - forTypes:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier - forTypes:arg_types - error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier forTypes:arg_types error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -905,7 +855,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess } @interface FWFWKWebViewConfigurationFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKWebViewConfigurationFlutterApi @@ -917,31 +867,32 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create" - binaryMessenger:self.binaryMessenger - codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -949,14 +900,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -973,113 +927,90 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKUserContentControllerHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = - [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addScriptMessageHandlerForControllerWithIdentifier: - handlerIdentifier:ofName:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" - @"ofName:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier - handlerIdentifier:arg_handlerIdentifier - ofName:arg_name - error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier handlerIdentifier:arg_handlerIdentifier ofName:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier - name:arg_name - error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier name:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1087,46 +1018,40 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: - userScript:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_identifier - userScript:arg_userScript - error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_identifier userScript:arg_userScript error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllUserScriptsForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1134,7 +1059,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1145,56 +1071,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier - isEnabled:arg_enabled - error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1205,18 +1121,15 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1224,7 +1137,8 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1232,13 +1146,15 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess @interface FWFWKScriptMessageHandlerFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKScriptMessageData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1246,11 +1162,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKScriptMessageHandlerFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1267,19 +1185,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKScriptMessageHandlerFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKScriptMessageHandlerFlutterApi @@ -1291,23 +1209,15 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier - userContentControllerIdentifier: - (NSNumber *)arg_userContentControllerIdentifier - message:(FWFWKScriptMessageData *)arg_message - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" - binaryMessenger:self.binaryMessenger - codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], - arg_message ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" + binaryMessenger:self.binaryMessenger + codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], arg_message ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end NSObject *FWFWKNavigationDelegateHostApiGetCodec() { @@ -1316,18 +1226,15 @@ - (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifi return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1335,7 +1242,8 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1343,25 +1251,27 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen @interface FWFWKNavigationDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKNavigationDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSErrorData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 131: + + case 131: return [FWFWKNavigationActionData fromList:[self readValue]]; - - case 132: + + case 132: return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1369,23 +1279,29 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKNavigationDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKNavigationDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1402,19 +1318,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKNavigationDelegateFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKNavigationDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1426,124 +1342,80 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - URL:(nullable NSString *)arg_url - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - URL:(nullable NSString *)arg_url - completion: - (void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - navigationAction: - (FWFWKNavigationActionData *)arg_navigationAction - completion: - (void (^)(FWFWKNavigationActionPolicyEnumData - *_Nullable, - NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_navigationAction ?: [NSNull null] - ] - reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); - }]; -} -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - error:(FWFNSErrorData *)arg_error - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { + FWFWKNavigationActionPolicyEnumData *output = reply; + completion(output, nil); + }]; +} +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - error:(FWFNSErrorData *)arg_error - completion: - (void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier: - (NSNumber *)arg_webViewIdentifier - completion:(void (^)(NSError *_Nullable)) - completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1551,11 +1423,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1572,29 +1446,26 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFNSObjectHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = - [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(disposeObjectWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1602,67 +1473,53 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addObserverForObjectWithIdentifier: - observerIdentifier:keyPath:options:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = - GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_identifier - observerIdentifier:arg_observerIdentifier - keyPath:arg_keyPath - options:arg_options - error:&error]; + [api addObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath options:arg_options error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: - observerIdentifier:keyPath:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_identifier - observerIdentifier:arg_observerIdentifier - keyPath:arg_keyPath - error:&error]; + [api removeObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1670,52 +1527,18 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, @interface FWFNSObjectFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: - return [FWFNSErrorData fromList:[self readValue]]; - - case 129: - return [FWFNSHttpCookieData fromList:[self readValue]]; - - case 130: - return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; - - case 131: + case 128: return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; - - case 132: - return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; - - case 133: - return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 134: - return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; - - case 135: - return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 136: - return [FWFWKNavigationActionData fromList:[self readValue]]; - - case 137: - return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; - - case 138: - return [FWFWKScriptMessageData fromList:[self readValue]]; - - case 139: - return [FWFWKUserScriptData fromList:[self readValue]]; - - case 140: - return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; - - case 141: - return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; - - default: + + case 129: + return [FWFObjectOrIdentifier fromList:[self readValue]]; + + default: return [super readValueOfType:type]; + } } @end @@ -1723,50 +1546,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectFlutterApiCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[FWFNSErrorData class]]) { +- (void)writeValue:(id)value +{ + if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else + if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { - [self writeByte:130]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { - [self writeByte:131]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { - [self writeByte:132]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { - [self writeByte:133]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { - [self writeByte:134]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { - [self writeByte:135]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { - [self writeByte:136]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { - [self writeByte:137]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { - [self writeByte:138]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { - [self writeByte:139]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { - [self writeByte:140]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { - [self writeByte:141]; - [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1783,19 +1573,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFNSObjectFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = - [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; + FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFNSObjectFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFNSObjectFlutterApi @@ -1807,87 +1597,81 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier - keyPath:(NSString *)arg_keyPath - objectIdentifier:(NSNumber *)arg_objectIdentifier - changeKeys: - (NSArray *)arg_changeKeys - changeValues:(NSArray *)arg_changeValues - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier keyPath:(NSString *)arg_keyPath objectIdentifier:(NSNumber *)arg_objectIdentifier changeKeys:(NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.observeValue" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], - arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], - arg_changeValues ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSErrorData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 134: + + case 134: + return [FWFObjectOrIdentifier fromList:[self readValue]]; + + case 135: return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; - - case 135: + + case 136: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 136: + + case 137: return [FWFWKNavigationActionData fromList:[self readValue]]; - - case 137: + + case 138: return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; - - case 138: + + case 139: return [FWFWKScriptMessageData fromList:[self readValue]]; - - case 139: + + case 140: return [FWFWKUserScriptData fromList:[self readValue]]; - - case 140: + + case 141: return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; - - case 141: + + case 142: return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1895,50 +1679,69 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { [self writeByte:134]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:136]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:137]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:138]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:139]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:140]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toList]]; - } else { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + [self writeByte:142]; + [self writeValue:[value toList]]; + } else +{ [super writeValue:value]; } } @@ -1955,105 +1758,89 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKWebViewHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_identifier - delegateIdentifier:arg_uiDelegateIdentifier - error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_uiDelegateIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier - delegateIdentifier:arg_navigationDelegateIdentifier - error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_navigationDelegateIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(URLForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2061,44 +1848,39 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: - error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier - error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: - request:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2107,75 +1889,63 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: - HTMLString:baseURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_identifier - HTMLString:arg_string - baseURL:arg_baseUrl - error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_identifier HTMLString:arg_string baseURL:arg_baseUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_identifier - fileURL:arg_url - readAccessURL:arg_readAccessUrl - error:&error]; + [api loadFileForWebViewWithIdentifier:arg_identifier fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: - assetKey:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2184,20 +1954,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2205,20 +1974,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2226,20 +1994,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2247,20 +2014,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2268,20 +2034,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(reloadWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2289,20 +2054,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(titleForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2310,85 +2074,71 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier - isAllowed:arg_allow - error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_identifier - userAgent:arg_userAgent - error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_identifier userAgent:arg_userAgent error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier - javaScriptString:arg_javaScriptString - completion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2399,18 +2149,15 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec()]; + codec:FWFWKUIDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2418,7 +2165,8 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2426,19 +2174,21 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, @interface FWFWKUIDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKUIDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFWKNavigationActionData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2446,17 +2196,21 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUIDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUIDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2473,19 +2227,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKUIDelegateFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKUIDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKUIDelegateFlutterApi @@ -2497,37 +2251,32 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - configurationIdentifier:(NSNumber *)arg_configurationIdentifier - navigationAction:(FWFWKNavigationActionData *)arg_navigationAction - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier configurationIdentifier:(NSNumber *)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2535,14 +2284,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2559,67 +2311,116 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end + NSObject *FWFWKHttpCookieStoreHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *api) { +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: - dataStoreIdentifier:error:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_identifier - dataStoreIdentifier:arg_websiteDataStoreIdentifier - error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: - cookie:completion:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_identifier - cookie:arg_cookie - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } } +NSObject *FWFNSUrlHostApiGetCodec() { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +void FWFNSUrlHostApiSetup(id binaryMessenger, NSObject *api) { + { + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString" + binaryMessenger:binaryMessenger + codec:FWFNSUrlHostApiGetCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(absoluteStringForNSURLWithIdentifier:error:)], @"FWFNSUrlHostApi api (%@) doesn't respond to @selector(absoluteStringForNSURLWithIdentifier:error:)", api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + FlutterError *error; + NSString *output = [api absoluteStringForNSURLWithIdentifier:arg_identifier error:&error]; + callback(wrapResult(output, error)); + }]; + } + else { + [channel setMessageHandler:nil]; + } + } +} +NSObject *FWFNSUrlFlutterApiGetCodec() { + static FlutterStandardMessageCodec *sSharedObject = nil; + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; + return sSharedObject; +} + +@interface FWFNSUrlFlutterApi () +@property (nonatomic, strong) NSObject *binaryMessenger; +@end + +@implementation FWFNSUrlFlutterApi + +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { + self = [super init]; + if (self) { + _binaryMessenger = binaryMessenger; + } + return self; +} +- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.NSUrlFlutterApi.create" + binaryMessenger:self.binaryMessenger + codec:FWFNSUrlFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index c88b2f4e56cb..c5984c9e1dcc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -3,9 +3,14 @@ // found in the LICENSE file. #import "FWFObjectHostApi.h" +#import #import "FWFDataConverters.h" +#import "FWFURLHostApi.h" @interface FWFObjectFlutterApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; // InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -15,6 +20,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen instanceManager:(FWFInstanceManager *)instanceManager { self = [self initWithBinaryMessenger:binaryMessenger]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -34,7 +40,25 @@ - (void)observeValueForObject:(NSObject *)instance [change enumerateKeysAndObjectsUsingBlock:^(NSKeyValueChangeKey key, id value, BOOL *stop) { [changeKeys addObject:FWFNSKeyValueChangeKeyEnumDataFromNSKeyValueChangeKey(key)]; - [changeValues addObject:value]; + BOOL isIdentifier = NO; + if ([self.instanceManager containsInstance:value]) { + isIdentifier = YES; + } else if (object_getClass(value) == [NSURL class]) { + FWFURLFlutterApiImpl *flutterApi = + [[FWFURLFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [flutterApi create:value + completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; + isIdentifier = YES; + } + + id returnValue = isIdentifier + ? @([self.instanceManager identifierWithStrongReferenceForInstance:value]) + : value; + [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue + isIdentifier:@(isIdentifier)]]; }]; NSNumber *objectIdentifier = diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h new file mode 100644 index 000000000000..dfa007fb2fa4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h @@ -0,0 +1,42 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host API implementation for `NSURL`. + * + * This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or method calls on the associated native class or an instance of the class. + */ +@interface FWFURLHostApiImpl : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +@end + +/** + * Flutter API implementation for `NSURL`. + * + * This class may handle instantiating and adding Dart instances that are attached to a native + * instance or sending callback methods from an overridden native class. + */ +@interface FWFURLFlutterApiImpl : NSObject +/** + * The Flutter API used to send messages back to Dart. + */ +@property FWFNSUrlFlutterApi *api; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +/** + * Sends a message to Dart to create a new Dart instance and add it to the `InstanceManager`. + */ +- (void)create:(NSURL *)instance completion:(void (^)(NSError *_Nullable))completion; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m new file mode 100644 index 000000000000..3bdeb6c89690 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFURLHostApi.h" + +@interface FWFURLHostApiImpl () +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. +@property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@interface FWFURLFlutterApiImpl () +// InstanceManager must be weak to prevent a circular reference with the object it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFURLHostApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _binaryMessenger = binaryMessenger; + _instanceManager = instanceManager; + } + return self; +} + +- (nullable NSString *) + absoluteStringForNSURLWithIdentifier:(nonnull NSNumber *)identifier + error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { + NSURL *instance = [self urlForIdentifier:identifier error:error]; + if (*error) { + return nil; + } + + return instance.absoluteString; +} + +- (nullable NSURL *)urlForIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { + NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier.longValue]; + + if (!instance) { + NSString *message = + [NSString stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %@", + identifier]; + *error = [FlutterError errorWithCode:NSInternalInconsistencyException + message:message + details:nil]; + } + + return instance; +} +@end + +@implementation FWFURLFlutterApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + _api = [[FWFNSUrlFlutterApi alloc] initWithBinaryMessenger:binaryMessenger]; + } + return self; +} + +- (void)create:(NSURL *)instance completion:(void (^)(NSError *_Nullable))completion { + [self.api createWithIdentifier:@([self.instanceManager addHostCreatedInstance:instance]) + completion:completion]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index b9ba942b4ed5..0e7cd27c49c4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -15,6 +15,7 @@ #import #import #import +#import #import #import #import 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 26f215e2684c..02655a495c50 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 (v4.2.13), do not edit directly. +// Autogenerated from Pigeon (v4.2.14), 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 import 'dart:async'; @@ -110,27 +110,22 @@ enum WKNavigationType { /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. linkActivated, - /// A request to submit a form. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. submitted, - /// A request for the frame’s next or previous item. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. backForward, - /// A request to reload the webpage. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. reload, - /// A request to resubmit a form. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. formResubmitted, - /// A navigation request that originates for some other reason. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. @@ -153,7 +148,8 @@ class NSKeyValueObservingOptionsEnumData { static NSKeyValueObservingOptionsEnumData decode(Object result) { result as List; return NSKeyValueObservingOptionsEnumData( - value: NSKeyValueObservingOptionsEnum.values[result[0]! as int], + value: NSKeyValueObservingOptionsEnum.values[result[0]! as int] +, ); } } @@ -174,7 +170,8 @@ class NSKeyValueChangeKeyEnumData { static NSKeyValueChangeKeyEnumData decode(Object result) { result as List; return NSKeyValueChangeKeyEnumData( - value: NSKeyValueChangeKeyEnum.values[result[0]! as int], + value: NSKeyValueChangeKeyEnum.values[result[0]! as int] +, ); } } @@ -195,7 +192,8 @@ class WKUserScriptInjectionTimeEnumData { static WKUserScriptInjectionTimeEnumData decode(Object result) { result as List; return WKUserScriptInjectionTimeEnumData( - value: WKUserScriptInjectionTimeEnum.values[result[0]! as int], + value: WKUserScriptInjectionTimeEnum.values[result[0]! as int] +, ); } } @@ -216,7 +214,8 @@ class WKAudiovisualMediaTypeEnumData { static WKAudiovisualMediaTypeEnumData decode(Object result) { result as List; return WKAudiovisualMediaTypeEnumData( - value: WKAudiovisualMediaTypeEnum.values[result[0]! as int], + value: WKAudiovisualMediaTypeEnum.values[result[0]! as int] +, ); } } @@ -237,7 +236,8 @@ class WKWebsiteDataTypeEnumData { static WKWebsiteDataTypeEnumData decode(Object result) { result as List; return WKWebsiteDataTypeEnumData( - value: WKWebsiteDataTypeEnum.values[result[0]! as int], + value: WKWebsiteDataTypeEnum.values[result[0]! as int] +, ); } } @@ -258,7 +258,8 @@ class WKNavigationActionPolicyEnumData { static WKNavigationActionPolicyEnumData decode(Object result) { result as List; return WKNavigationActionPolicyEnumData( - value: WKNavigationActionPolicyEnum.values[result[0]! as int], + value: WKNavigationActionPolicyEnum.values[result[0]! as int] +, ); } } @@ -279,7 +280,8 @@ class NSHttpCookiePropertyKeyEnumData { static NSHttpCookiePropertyKeyEnumData decode(Object result) { result as List; return NSHttpCookiePropertyKeyEnumData( - value: NSHttpCookiePropertyKeyEnum.values[result[0]! as int], + value: NSHttpCookiePropertyKeyEnum.values[result[0]! as int] +, ); } } @@ -318,8 +320,7 @@ class NSUrlRequestData { url: result[0]! as String, httpMethod: result[1] as String?, httpBody: result[2] as Uint8List?, - allHttpHeaderFields: - (result[3] as Map?)!.cast(), + allHttpHeaderFields: (result[3] as Map?)!.cast(), ); } } @@ -353,8 +354,7 @@ class WKUserScriptData { return WKUserScriptData( source: result[0]! as String, injectionTime: result[1] != null - ? WKUserScriptInjectionTimeEnumData.decode( - result[1]! as List) + ? WKUserScriptInjectionTimeEnumData.decode(result[1]! as List) : null, isMainFrameOnly: result[2]! as bool, ); @@ -388,9 +388,12 @@ class WKNavigationActionData { static WKNavigationActionData decode(Object result) { result as List; return WKNavigationActionData( - request: NSUrlRequestData.decode(result[0]! as List), - targetFrame: WKFrameInfoData.decode(result[1]! as List), - navigationType: WKNavigationType.values[result[2]! as int], + request: NSUrlRequestData.decode(result[0]! as List) +, + targetFrame: WKFrameInfoData.decode(result[1]! as List) +, + navigationType: WKNavigationType.values[result[2]! as int] +, ); } } @@ -505,13 +508,43 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object result) { result as List; return NSHttpCookieData( - propertyKeys: (result[0] as List?)! - .cast(), + propertyKeys: (result[0] as List?)!.cast(), propertyValues: (result[1] as List?)!.cast(), ); } } +/// An object that can represent either a value supported by +/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier +/// of an object stored in an `InstanceManager`. +class ObjectOrIdentifier { + ObjectOrIdentifier({ + this.value, + required this.isIdentifier, + }); + + Object? value; + + /// Whether value is an int that is used to retrieve an instance stored in an + /// `InstanceManager`. + bool isIdentifier; + + Object encode() { + return [ + value, + isIdentifier, + ]; + } + + static ObjectOrIdentifier decode(Object result) { + result as List; + return ObjectOrIdentifier( + value: result[0] as Object?, + isIdentifier: result[1]! as bool, + ); + } +} + class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _WKWebsiteDataStoreHostApiCodec(); @override @@ -527,11 +560,13 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -549,15 +584,12 @@ class WKWebsiteDataStoreHostApi { static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -576,8 +608,7 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -597,18 +628,12 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes( - int arg_identifier, - List arg_dataTypes, - double arg_modificationTimeInSecondsSinceEpoch) async { + Future removeDataOfTypes(int arg_identifier, List arg_dataTypes, double arg_modificationTimeInSecondsSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_dataTypes, - arg_modificationTimeInSecondsSinceEpoch - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -631,6 +656,7 @@ class WKWebsiteDataStoreHostApi { } } + /// Mirror of UIView. /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @@ -648,8 +674,8 @@ class UIViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_value]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -670,8 +696,8 @@ class UIViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_opaque]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_opaque]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,6 +715,7 @@ class UIViewHostApi { } } + /// Mirror of UIScrollView. /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @@ -702,14 +729,12 @@ class UIScrollViewHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future createFromWebView( - int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier]) - as List?; + await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -757,8 +782,8 @@ class UIScrollViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -775,13 +800,12 @@ class UIScrollViewHostApi { } } - Future setContentOffset( - int arg_identifier, double arg_x, double arg_y) async { + Future setContentOffset(int arg_identifier, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -814,11 +838,13 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -834,8 +860,7 @@ class WKWebViewConfigurationHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); Future create(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( @@ -859,15 +884,12 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView( - int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier]) - as List?; + await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -884,14 +906,12 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback( - int arg_identifier, bool arg_allow) async { + Future setAllowsInlineMediaPlayback(int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_allow]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_allow]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -908,14 +928,12 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, - List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_types]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_types]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -933,6 +951,7 @@ class WKWebViewConfigurationHostApi { } } + /// Handles callbacks from an WKWebViewConfiguration instance. /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @@ -941,8 +960,7 @@ abstract class WKWebViewConfigurationFlutterApi { void create(int identifier); - static void setup(WKWebViewConfigurationFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WKWebViewConfigurationFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create', codec, @@ -952,11 +970,10 @@ abstract class WKWebViewConfigurationFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); api.create(arg_identifier!); return; }); @@ -983,14 +1000,16 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1006,18 +1025,14 @@ class WKUserContentControllerHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1034,15 +1049,12 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler( - int arg_identifier, int arg_handlerIdentifier, String arg_name) async { + Future addScriptMessageHandler(int arg_identifier, int arg_handlerIdentifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_handlerIdentifier, arg_name]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_handlerIdentifier, arg_name]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1059,14 +1071,12 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler( - int arg_identifier, String arg_name) async { + Future removeScriptMessageHandler(int arg_identifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_name]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_name]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1085,8 +1095,7 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1106,14 +1115,12 @@ class WKUserContentControllerHostApi { } } - Future addUserScript( - int arg_identifier, WKUserScriptData arg_userScript) async { + Future addUserScript(int arg_identifier, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_userScript]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_userScript]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1132,8 +1139,7 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1154,6 +1160,7 @@ class WKUserContentControllerHostApi { } } + /// Mirror of WKUserPreferences. /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @@ -1167,15 +1174,12 @@ class WKPreferencesHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future createFromWebViewConfiguration( - int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1192,13 +1196,12 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled( - int arg_identifier, bool arg_enabled) async { + Future setJavaScriptEnabled(int arg_identifier, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1216,6 +1219,7 @@ class WKPreferencesHostApi { } } + /// Mirror of WKScriptMessageHandler. /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @@ -1267,11 +1271,13 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKScriptMessageData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1280,38 +1286,29 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. abstract class WKScriptMessageHandlerFlutterApi { - static const MessageCodec codec = - _WKScriptMessageHandlerFlutterApiCodec(); + static const MessageCodec codec = _WKScriptMessageHandlerFlutterApiCodec(); - void didReceiveScriptMessage(int identifier, - int userContentControllerIdentifier, WKScriptMessageData message); + void didReceiveScriptMessage(int identifier, int userContentControllerIdentifier, WKScriptMessageData message); - static void setup(WKScriptMessageHandlerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WKScriptMessageHandlerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', - codec, + 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); final int? arg_userContentControllerIdentifier = (args[1] as int?); - assert(arg_userContentControllerIdentifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); - final WKScriptMessageData? arg_message = - (args[2] as WKScriptMessageData?); - assert(arg_message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, - arg_userContentControllerIdentifier!, arg_message!); + assert(arg_userContentControllerIdentifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + final WKScriptMessageData? arg_message = (args[2] as WKScriptMessageData?); + assert(arg_message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); + api.didReceiveScriptMessage(arg_identifier!, arg_userContentControllerIdentifier!, arg_message!); return; }); } @@ -1319,6 +1316,7 @@ abstract class WKScriptMessageHandlerFlutterApi { } } + /// Mirror of WKNavigationDelegate. /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @@ -1382,23 +1380,25 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSUrlRequestData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKFrameInfoData.decode(readValue(buffer)!); - - case 131: + + case 131: return WKNavigationActionData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1407,183 +1407,145 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = - _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); void didFinishNavigation(int identifier, int webViewIdentifier, String? url); - void didStartProvisionalNavigation( - int identifier, int webViewIdentifier, String? url); + void didStartProvisionalNavigation(int identifier, int webViewIdentifier, String? url); - Future decidePolicyForNavigationAction( - int identifier, - int webViewIdentifier, - WKNavigationActionData navigationAction); + Future decidePolicyForNavigationAction(int identifier, int webViewIdentifier, WKNavigationActionData navigationAction); - void didFailNavigation( - int identifier, int webViewIdentifier, NSErrorData error); + void didFailNavigation(int identifier, int webViewIdentifier, NSErrorData error); - void didFailProvisionalNavigation( - int identifier, int webViewIdentifier, NSErrorData error); + void didFailProvisionalNavigation(int identifier, int webViewIdentifier, NSErrorData error); - void webViewWebContentProcessDidTerminate( - int identifier, int webViewIdentifier); + void webViewWebContentProcessDidTerminate(int identifier, int webViewIdentifier); - static void setup(WKNavigationDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didFinishNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didStartProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = - (args[2] as WKNavigationActionData?); - assert(arg_navigationAction != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = - await api.decidePolicyForNavigationAction(arg_identifier!, - arg_webViewIdentifier!, arg_navigationAction!); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = (args[2] as WKNavigationActionData?); + assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); + final WKNavigationActionPolicyEnumData output = await api.decidePolicyForNavigationAction(arg_identifier!, arg_webViewIdentifier!, arg_navigationAction!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); + api.didFailNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); + api.didFailProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', - codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate( - arg_identifier!, arg_webViewIdentifier!); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + api.webViewWebContentProcessDidTerminate(arg_identifier!, arg_webViewIdentifier!); return; }); } @@ -1606,11 +1568,13 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1650,20 +1614,12 @@ class NSObjectHostApi { } } - Future addObserver( - int arg_identifier, - int arg_observerIdentifier, - String arg_keyPath, - List arg_options) async { + Future addObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath, List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_observerIdentifier, - arg_keyPath, - arg_options - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath, arg_options]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1680,14 +1636,12 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_identifier, int arg_observerIdentifier, - String arg_keyPath) async { + Future removeObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_identifier, arg_observerIdentifier, arg_keyPath]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1709,48 +1663,12 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { const _NSObjectFlutterApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NSErrorData) { + if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else if (value is ObjectOrIdentifier) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { - buffer.putUint8(133); - writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { - buffer.putUint8(134); - writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { - buffer.putUint8(135); - writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { - buffer.putUint8(136); - writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { - buffer.putUint8(137); - writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { - buffer.putUint8(138); - writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { - buffer.putUint8(139); - writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { - buffer.putUint8(140); - writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { - buffer.putUint8(141); - writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1759,50 +1677,16 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return NSErrorData.decode(readValue(buffer)!); - - case 129: - return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: - return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + case 128: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: - return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: - return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: - return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: - return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: - return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: - return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: - return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: - return WKUserScriptData.decode(readValue(buffer)!); - - case 140: - return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: - return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - + + case 129: + return ObjectOrIdentifier.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } } } @@ -1813,17 +1697,11 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { abstract class NSObjectFlutterApi { static const MessageCodec codec = _NSObjectFlutterApiCodec(); - void observeValue( - int identifier, - String keyPath, - int objectIdentifier, - List changeKeys, - List changeValues); + void observeValue(int identifier, String keyPath, int objectIdentifier, List changeKeys, List changeValues); void dispose(int identifier); - static void setup(NSObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(NSObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, @@ -1833,27 +1711,19 @@ abstract class NSObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); final String? arg_keyPath = (args[1] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); final int? arg_objectIdentifier = (args[2] as int?); - assert(arg_objectIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); - final List? arg_changeKeys = - (args[3] as List?)?.cast(); - assert(arg_changeKeys != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - final List? arg_changeValues = - (args[4] as List?)?.cast(); - assert(arg_changeValues != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, - arg_changeKeys!, arg_changeValues!); + assert(arg_objectIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + final List? arg_changeKeys = (args[3] as List?)?.cast(); + assert(arg_changeKeys != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + final List? arg_changeValues = (args[4] as List?)?.cast(); + assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); return; }); } @@ -1867,11 +1737,10 @@ abstract class NSObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return; }); @@ -1902,30 +1771,33 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { } else if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is ObjectOrIdentifier) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); + } else if (value is WKWebsiteDataTypeEnumData) { + buffer.putUint8(142); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1934,50 +1806,55 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: + return ObjectOrIdentifier.decode(readValue(buffer)!); + + case 135: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 136: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 137: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 138: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 139: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 140: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 141: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 142: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1995,14 +1872,12 @@ class WKWebViewHostApi { static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create( - int arg_identifier, int arg_configurationIdentifier) async { + Future create(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2019,14 +1894,12 @@ class WKWebViewHostApi { } } - Future setUIDelegate( - int arg_identifier, int? arg_uiDelegateIdentifier) async { + Future setUIDelegate(int arg_identifier, int? arg_uiDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_uiDelegateIdentifier]) - as List?; + await channel.send([arg_identifier, arg_uiDelegateIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2043,14 +1916,12 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate( - int arg_identifier, int? arg_navigationDelegateIdentifier) async { + Future setNavigationDelegate(int arg_identifier, int? arg_navigationDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_navigationDelegateIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_navigationDelegateIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2116,13 +1987,12 @@ class WKWebViewHostApi { } } - Future loadRequest( - int arg_identifier, NSUrlRequestData arg_request) async { + Future loadRequest(int arg_identifier, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_request]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_request]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2139,14 +2009,12 @@ class WKWebViewHostApi { } } - Future loadHtmlString( - int arg_identifier, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString(int arg_identifier, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_string, arg_baseUrl]) - as List?; + await channel.send([arg_identifier, arg_string, arg_baseUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2163,14 +2031,12 @@ class WKWebViewHostApi { } } - Future loadFileUrl( - int arg_identifier, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl(int arg_identifier, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_url, arg_readAccessUrl]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_url, arg_readAccessUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2191,8 +2057,8 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_key]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_key]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2351,14 +2217,12 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures( - int arg_identifier, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures(int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_allow]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_allow]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2375,13 +2239,12 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent( - int arg_identifier, String? arg_userAgent) async { + Future setCustomUserAgent(int arg_identifier, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_userAgent]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_userAgent]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2398,14 +2261,12 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript( - int arg_identifier, String arg_javaScriptString) async { + Future evaluateJavaScript(int arg_identifier, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_javaScriptString]) - as List?; + await channel.send([arg_identifier, arg_javaScriptString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2423,6 +2284,7 @@ class WKWebViewHostApi { } } + /// Mirror of WKUIDelegate. /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @@ -2480,17 +2342,19 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSUrlRequestData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKFrameInfoData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKNavigationActionData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -2501,11 +2365,9 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { abstract class WKUIDelegateFlutterApi { static const MessageCodec codec = _WKUIDelegateFlutterApiCodec(); - void onCreateWebView(int identifier, int webViewIdentifier, - int configurationIdentifier, WKNavigationActionData navigationAction); + void onCreateWebView(int identifier, int webViewIdentifier, int configurationIdentifier, WKNavigationActionData navigationAction); - static void setup(WKUIDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, @@ -2515,23 +2377,17 @@ abstract class WKUIDelegateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[2] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = - (args[3] as WKNavigationActionData?); - assert(arg_navigationAction != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, - arg_configurationIdentifier!, arg_navigationAction!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = (args[3] as WKNavigationActionData?); + assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, arg_configurationIdentifier!, arg_navigationAction!); return; }); } @@ -2557,14 +2413,16 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -2582,15 +2440,12 @@ class WKHttpCookieStoreHostApi { static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore( - int arg_identifier, int arg_websiteDataStoreIdentifier) async { + Future createFromWebsiteDataStore(int arg_identifier, int arg_websiteDataStoreIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_websiteDataStoreIdentifier]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_websiteDataStoreIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2607,13 +2462,12 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie( - int arg_identifier, NSHttpCookieData arg_cookie) async { + Future setCookie(int arg_identifier, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_cookie]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_cookie]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2630,3 +2484,79 @@ class WKHttpCookieStoreHostApi { } } } + + +/// Host API for `NSUrl`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +class NSUrlHostApi { + /// Constructor for [NSUrlHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + NSUrlHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future getAbsoluteString(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return (replyList[0] as String?); + } + } +} + + +/// Flutter API for `NSUrl`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +abstract class NSUrlFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + void create(int identifier); + + static void setup(NSUrlFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.NSUrlFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index 9f121e66d5cb..c13731324b6c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -235,6 +235,43 @@ class NSHttpCookie { final Map properties; } + +/// An object that represents the location of a resource, such as an item on a +/// remote server or the path to a local file. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +class NSUrl extends NSObject { + /// Instantiates a [NSUrl] without creating and attaching to an instance + /// of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + NSUrl.detached({super.binaryMessenger, super.instanceManager}) + : _nsUrlHostApi = NSUrlHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + + final NSUrlHostApiImpl _nsUrlHostApi; + + /// The URL string for the receiver as an absolute URL. (read-only) + /// + /// Represents [NSURL.absoluteString](https://developer.apple.com/documentation/foundation/nsurl/1409868-absolutestring?language=objc). + Future getAbsoluteString() { + return _nsUrlHostApi.getAbsoluteStringFromInstances(this); + } + + @override + NSObject copy() { + return NSUrl.detached( + binaryMessenger: _nsUrlHostApi.binaryMessenger, + instanceManager: _nsUrlHostApi.instanceManager, + ); + } +} + /// The root class of most Objective-C class hierarchies. @immutable class NSObject with Copyable { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart index 445e232bb0ac..4f73c0825580 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart @@ -52,7 +52,9 @@ class FoundationFlutterApis { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, }) : _binaryMessenger = binaryMessenger, - object = NSObjectFlutterApiImpl( + object = NSObjectFlutterApiImpl(instanceManager: instanceManager), + url = NSUrlFlutterApiImpl( + binaryMessenger: binaryMessenger, instanceManager: instanceManager, ); @@ -76,6 +78,10 @@ class FoundationFlutterApis { @visibleForTesting final NSObjectFlutterApiImpl object; + /// Flutter Api for [NSUrl]. + @visibleForTesting + final NSUrlFlutterApiImpl url; + /// Ensures all the Flutter APIs have been set up to receive calls from native code. void ensureSetUp() { if (!_hasBeenSetUp) { @@ -83,6 +89,7 @@ class FoundationFlutterApis { object, binaryMessenger: _binaryMessenger, ); + NSUrlFlutterApi.setup(url, binaryMessenger: _binaryMessenger); _hasBeenSetUp = true; } } @@ -154,7 +161,7 @@ class NSObjectFlutterApiImpl extends NSObjectFlutterApi { String keyPath, int objectIdentifier, List changeKeys, - List changeValues, + List changeValues, ) { final void Function(String, NSObject, Map)? function = _getObject(identifier).observeValue; @@ -163,11 +170,20 @@ class NSObjectFlutterApiImpl extends NSObjectFlutterApi { instanceManager.getInstanceWithWeakReference(objectIdentifier)! as NSObject, Map.fromIterables( - changeKeys.map( - (NSKeyValueChangeKeyEnumData? data) { - return data!.toNSKeyValueChangeKey(); - }, - ), changeValues), + changeKeys.map( + (NSKeyValueChangeKeyEnumData? data) { + return data!.toNSKeyValueChangeKey(); + }, + ), + changeValues.map((ObjectOrIdentifier? value) { + if (value != null && value.isIdentifier) { + return instanceManager.getInstanceWithWeakReference( + value.value! as int, + ); + } + return value?.value; + }), + ), ); } @@ -176,3 +192,60 @@ class NSObjectFlutterApiImpl extends NSObjectFlutterApi { instanceManager.remove(identifier); } } + +/// Host api implementation for [NSUrl]. +class NSUrlHostApiImpl extends NSUrlHostApi { + /// Constructs an [NSUrlHostApiImpl]. + NSUrlHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with Objective-C objects. + final InstanceManager instanceManager; + + /// Calls [getAbsoluteString] with the ids of the provided object instances. + Future getAbsoluteStringFromInstances(NSUrl instance) { + return getAbsoluteString(instanceManager.getIdentifier(instance)!); + } +} + +/// Flutter API implementation for [NSUrl]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class NSUrlFlutterApiImpl implements NSUrlFlutterApi { + /// Constructs a [NSUrlFlutterApiImpl]. + NSUrlFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + NSUrl.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} 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 8abd0c1afe8a..253b71af482e 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 @@ -130,6 +130,14 @@ class WebKitWebViewController extends PlatformWebViewController { NSKeyValueObservingOptions.newValue, }, ); + + _webView.addObserver( + _webView, + keyPath: 'URL', + options: { + NSKeyValueObservingOptions.newValue, + }, + ); } /// The WebKit WebView being controlled. @@ -142,13 +150,30 @@ class WebKitWebViewController extends PlatformWebViewController { String keyPath, NSObject object, Map change, - ) { - final ProgressCallback? progressCallback = - weakReference.target?._currentNavigationDelegate?._onProgress; - if (progressCallback != null) { - final double progress = - change[NSKeyValueChangeKey.newValue]! as double; - progressCallback((progress * 100).round()); + ) async { + final WebKitWebViewController? controller = weakReference.target; + if (controller == null) { + return; + } + + switch (keyPath) { + case 'estimatedProgress': + final ProgressCallback? progressCallback = + controller._currentNavigationDelegate?._onProgress; + if (progressCallback != null) { + final double progress = + change[NSKeyValueChangeKey.newValue]! as double; + progressCallback((progress * 100).round()); + } + break; + case 'URL': + final UrlChangeCallback? urlChangeCallback = + controller._currentNavigationDelegate?._onUrlChange; + if (urlChangeCallback != null) { + final NSUrl url = change[NSKeyValueChangeKey.newValue]! as NSUrl; + urlChangeCallback(UrlChange(url: await url.getAbsoluteString())); + } + break; } }; }), @@ -691,6 +716,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ProgressCallback? _onProgress; WebResourceErrorCallback? _onWebResourceError; NavigationRequestCallback? _onNavigationRequest; + UrlChangeCallback? _onUrlChange; @override Future setOnPageFinished(PageEventCallback onPageFinished) async { @@ -720,4 +746,9 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ) async { _onNavigationRequest = onNavigationRequest; } + + @override + Future setOnUrlChange(UrlChangeCallback onUrlChange) async { + _onUrlChange = onUrlChange; + } } 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 9b334c2411ff..4eada7ba74e9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -267,6 +267,17 @@ class NSHttpCookieData { late List propertyValues; } +/// An object that can represent either a value supported by +/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier +/// of an object stored in an `InstanceManager`. +class ObjectOrIdentifier { + late Object? value; + + /// Whether value is an int that is used to retrieve an instance stored in an + /// `InstanceManager`. + late bool isIdentifier; +} + /// Mirror of WKWebsiteDataStore. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @@ -545,7 +556,7 @@ abstract class NSObjectFlutterApi { // conform to `NSCopying`. This splits the map of properties into a list of // keys and values with the ordered maintained. List changeKeys, - List changeValues, + List changeValues, ); @ObjCSelector('disposeObjectWithIdentifier:') @@ -655,3 +666,29 @@ abstract class WKHttpCookieStoreHostApi { @async void setCookie(int identifier, NSHttpCookieData cookie); } + +/// Host API for `NSUrl`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +@HostApi(dartHostTestHandler: 'TestNSUrlHostApi') +abstract class NSUrlHostApi { + @ObjCSelector('absoluteStringForNSURLWithIdentifier:') + String? getAbsoluteString(int identifier); +} + +/// Flutter API for `NSUrl`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +@FlutterApi() +abstract class NSUrlFlutterApi { + @ObjCSelector('createWithIdentifier:') + void create(int identifier); +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index c486fae80962..05fbbead1741 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.1.1 +version: 3.2.0 environment: sdk: ">=2.17.0 <3.0.0" @@ -30,3 +30,9 @@ dev_dependencies: sdk: flutter mockito: ^5.3.2 pigeon: ^4.2.13 + + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_platform_interface: + path: ../../webview_flutter/webview_flutter_platform_interface 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 860e8dbeb4ce..27eba93ade54 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 1680997d5856..a4057bf3affb 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart index 5c31f63c3add..68c8a2a0fe79 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_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 (v4.2.13), do not edit directly. +// Autogenerated from Pigeon (v4.2.14), 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, unnecessary_import // ignore_for_file: avoid_relative_lib_imports @@ -28,11 +28,13 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -41,60 +43,48 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = - _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration( - int identifier, int configurationIdentifier); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); void createDefaultDataStore(int identifier); - Future removeDataOfTypes( - int identifier, - List dataTypes, - double modificationTimeInSecondsSinceEpoch); + Future removeDataOfTypes(int identifier, List dataTypes, double modificationTimeInSecondsSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_identifier!); return []; }); @@ -102,29 +92,22 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', - codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = - (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); - final double? arg_modificationTimeInSecondsSinceEpoch = - (args[2] as double?); - assert(arg_modificationTimeInSecondsSinceEpoch != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, - arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + final double? arg_modificationTimeInSecondsSinceEpoch = (args[2] as double?); + assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_identifier!, arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); return [output]; }); } @@ -132,6 +115,7 @@ abstract class TestWKWebsiteDataStoreHostApi { } } + /// Mirror of UIView. /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @@ -142,8 +126,7 @@ abstract class TestUIViewHostApi { void setOpaque(int identifier, bool opaque); - static void setup(TestUIViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, @@ -153,11 +136,10 @@ abstract class TestUIViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_identifier!, arg_value); return []; @@ -173,14 +155,12 @@ abstract class TestUIViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_identifier!, arg_opaque!); return []; }); @@ -189,6 +169,7 @@ abstract class TestUIViewHostApi { } } + /// Mirror of UIScrollView. /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @@ -203,8 +184,7 @@ abstract class TestUIScrollViewHostApi { void setContentOffset(int identifier, double x, double y); - static void setup(TestUIScrollViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, @@ -214,14 +194,12 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return []; }); @@ -236,11 +214,10 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_identifier!); return [output]; }); @@ -255,17 +232,14 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_identifier!, arg_x!, arg_y!); return []; }); @@ -280,17 +254,14 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_identifier!, arg_x!, arg_y!); return []; }); @@ -314,11 +285,13 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -327,8 +300,7 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = - _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); void create(int identifier); @@ -336,11 +308,9 @@ abstract class TestWKWebViewConfigurationHostApi { void setAllowsInlineMediaPlayback(int identifier, bool allow); - void setMediaTypesRequiringUserActionForPlayback( - int identifier, List types); + void setMediaTypesRequiringUserActionForPlayback(int identifier, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, @@ -350,11 +320,10 @@ abstract class TestWKWebViewConfigurationHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -362,22 +331,19 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return []; }); @@ -385,22 +351,19 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); return []; }); @@ -408,26 +371,20 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = - (args[1] as List?) - ?.cast(); - assert(arg_types != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_identifier!, arg_types!); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = (args[1] as List?)?.cast(); + assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback(arg_identifier!, arg_types!); return []; }); } @@ -453,14 +410,16 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -469,14 +428,11 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = - _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration( - int identifier, int configurationIdentifier); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); - void addScriptMessageHandler( - int identifier, int handlerIdentifier, String name); + void addScriptMessageHandler(int identifier, int handlerIdentifier, String name); void removeScriptMessageHandler(int identifier, String name); @@ -486,77 +442,64 @@ abstract class TestWKUserContentControllerHostApi { void removeAllUserScripts(int identifier); - static void setup(TestWKUserContentControllerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerIdentifier = (args[1] as int?); - assert(arg_handlerIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_identifier!, arg_handlerIdentifier!, arg_name!); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler(arg_identifier!, arg_handlerIdentifier!, arg_name!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_identifier!, arg_name!); return []; }); @@ -564,19 +507,17 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_identifier!); return []; }); @@ -584,23 +525,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = - (args[1] as WKUserScriptData?); - assert(arg_userScript != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); + assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_identifier!, arg_userScript!); return []; }); @@ -608,19 +545,17 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_identifier!); return []; }); @@ -629,39 +564,34 @@ abstract class TestWKUserContentControllerHostApi { } } + /// Mirror of WKUserPreferences. /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. abstract class TestWKPreferencesHostApi { static const MessageCodec codec = StandardMessageCodec(); - void createFromWebViewConfiguration( - int identifier, int configurationIdentifier); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); void setJavaScriptEnabled(int identifier, bool enabled); - static void setup(TestWKPreferencesHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return []; }); } @@ -675,14 +605,12 @@ abstract class TestWKPreferencesHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); return []; }); @@ -691,6 +619,7 @@ abstract class TestWKPreferencesHostApi { } } + /// Mirror of WKScriptMessageHandler. /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @@ -699,8 +628,7 @@ abstract class TestWKScriptMessageHandlerHostApi { void create(int identifier); - static void setup(TestWKScriptMessageHandlerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, @@ -710,11 +638,10 @@ abstract class TestWKScriptMessageHandlerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -723,6 +650,7 @@ abstract class TestWKScriptMessageHandlerHostApi { } } + /// Mirror of WKNavigationDelegate. /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @@ -731,8 +659,7 @@ abstract class TestWKNavigationDelegateHostApi { void create(int identifier); - static void setup(TestWKNavigationDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, @@ -742,11 +669,10 @@ abstract class TestWKNavigationDelegateHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -770,11 +696,13 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -787,13 +715,11 @@ abstract class TestNSObjectHostApi { void dispose(int identifier); - void addObserver(int identifier, int observerIdentifier, String keyPath, - List options); + void addObserver(int identifier, int observerIdentifier, String keyPath, List options); void removeObserver(int identifier, int observerIdentifier, String keyPath); - static void setup(TestNSObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, @@ -803,11 +729,10 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return []; }); @@ -822,24 +747,17 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = - (args[3] as List?) - ?.cast(); - assert(arg_options != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, - arg_keyPath!, arg_options!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = (args[3] as List?)?.cast(); + assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!, arg_options!); return []; }); } @@ -853,19 +771,15 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!); return []; }); } @@ -895,30 +809,33 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { } else if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is ObjectOrIdentifier) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); + } else if (value is WKWebsiteDataTypeEnumData) { + buffer.putUint8(142); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -927,50 +844,55 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: + return ObjectOrIdentifier.decode(readValue(buffer)!); + + case 135: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 136: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 137: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 138: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 139: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 140: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 141: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 142: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1017,8 +939,7 @@ abstract class TestWKWebViewHostApi { Future evaluateJavaScript(int identifier, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, @@ -1028,14 +949,12 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_identifier!, arg_configurationIdentifier!); return []; }); @@ -1050,11 +969,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); return []; @@ -1070,14 +988,12 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate( - arg_identifier!, arg_navigationDelegateIdentifier); + api.setNavigationDelegate(arg_identifier!, arg_navigationDelegateIdentifier); return []; }); } @@ -1091,11 +1007,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_identifier!); return [output]; }); @@ -1110,11 +1025,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_identifier!); return [output]; }); @@ -1129,14 +1043,12 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_identifier!, arg_request!); return []; }); @@ -1151,14 +1063,12 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); return []; @@ -1174,17 +1084,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); return []; }); @@ -1199,14 +1106,12 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_identifier!, arg_key!); return []; }); @@ -1221,11 +1126,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_identifier!); return [output]; }); @@ -1240,11 +1144,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_identifier!); return [output]; }); @@ -1259,11 +1162,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_identifier!); return []; }); @@ -1278,11 +1180,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_identifier!); return []; }); @@ -1297,11 +1198,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_identifier!); return []; }); @@ -1316,11 +1216,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_identifier!); return [output]; }); @@ -1328,24 +1227,20 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_identifier!, arg_allow!); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures(arg_identifier!, arg_allow!); return []; }); } @@ -1359,11 +1254,10 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_identifier!, arg_userAgent); return []; @@ -1379,16 +1273,13 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_identifier!, arg_javaScriptString!); + assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript(arg_identifier!, arg_javaScriptString!); return [output]; }); } @@ -1396,6 +1287,7 @@ abstract class TestWKWebViewHostApi { } } + /// Mirror of WKUIDelegate. /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @@ -1404,8 +1296,7 @@ abstract class TestWKUIDelegateHostApi { void create(int identifier); - static void setup(TestWKUIDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, @@ -1415,11 +1306,10 @@ abstract class TestWKUIDelegateHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -1446,14 +1336,16 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - + default: + return super.readValueOfType(type, buffer); + } } } @@ -1462,36 +1354,29 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = - _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore( - int identifier, int websiteDataStoreIdentifier); + void createFromWebsiteDataStore(int identifier, int websiteDataStoreIdentifier); Future setCookie(int identifier, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreIdentifier = (args[1] as int?); - assert(arg_websiteDataStoreIdentifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_identifier!, arg_websiteDataStoreIdentifier!); + assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore(arg_identifier!, arg_websiteDataStoreIdentifier!); return []; }); } @@ -1505,14 +1390,12 @@ abstract class TestWKHttpCookieStoreHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_identifier!, arg_cookie!); return []; }); @@ -1520,3 +1403,38 @@ abstract class TestWKHttpCookieStoreHostApi { } } } + + +/// Host API for `NSUrl`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or method calls on the associated native +/// class or an instance of the class. +/// +/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. +abstract class TestNSUrlHostApi { + static const MessageCodec codec = StandardMessageCodec(); + + String? getAbsoluteString(int identifier); + + static void setup(TestNSUrlHostApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null, expected non-null int.'); + final String? output = api.getAbsoluteString(arg_identifier!); + return [output]; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart index b9536208c716..a6e042791f06 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart @@ -17,6 +17,7 @@ import 'foundation_test.mocks.dart'; @GenerateMocks([ TestNSObjectHostApi, + TestNSUrlHostApi, ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -137,7 +138,9 @@ void main() { [ NSKeyValueChangeKeyEnumData(value: NSKeyValueChangeKeyEnum.oldValue) ], - ['value'], + [ + ObjectOrIdentifier(isIdentifier: false, value: 'value'), + ], ); expect( @@ -152,6 +155,55 @@ void main() { ); }); + test('observeValue returns object in an `InstanceManager`', () async { + final Completer> argsCompleter = + Completer>(); + + FoundationFlutterApis.instance = FoundationFlutterApis( + instanceManager: instanceManager, + ); + + object = NSObject.detached( + instanceManager: instanceManager, + observeValue: ( + String keyPath, + NSObject object, + Map change, + ) { + argsCompleter.complete([keyPath, object, change]); + }, + ); + instanceManager.addHostCreatedInstance(object, 1); + + final NSObject returnedObject = NSObject.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(returnedObject, 2); + + FoundationFlutterApis.instance.object.observeValue( + 1, + 'keyPath', + 1, + [ + NSKeyValueChangeKeyEnumData(value: NSKeyValueChangeKeyEnum.oldValue) + ], + [ + ObjectOrIdentifier(isIdentifier: true, value: 2), + ], + ); + + expect( + argsCompleter.future, + completion([ + 'keyPath', + object, + { + NSKeyValueChangeKey.oldValue: returnedObject, + }, + ]), + ); + }); + test('NSObjectFlutterApi.dispose', () { FoundationFlutterApis.instance = FoundationFlutterApis( instanceManager: instanceManager, @@ -166,5 +218,32 @@ void main() { expect(instanceManager.containsIdentifier(1), isFalse); }); }); + + group('NSUrl', () { + // Ensure the test host api is removed after each test run. + tearDown(() => TestNSUrlHostApi.setup(null)); + + test('getAbsoluteString', () async { + final MockTestNSUrlHostApi mockApi = MockTestNSUrlHostApi(); + TestNSUrlHostApi.setup(mockApi); + + final NSUrl url = NSUrl.detached(instanceManager: instanceManager); + instanceManager.addHostCreatedInstance(url, 0); + + when(mockApi.getAbsoluteString(0)).thenReturn('myString'); + + expect(await url.getAbsoluteString(), 'myString'); + }); + + test('Flutter API create', () { + final NSUrlFlutterApi flutterApi = NSUrlFlutterApiImpl( + instanceManager: instanceManager, + ); + + flutterApi.create(0); + + expect(instanceManager.getInstanceWithWeakReference(0), isA()); + }); + }); }); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart index d93198ed9d2f..dea6e39fa013 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart @@ -73,3 +73,19 @@ class MockTestNSObjectHostApi extends _i1.Mock returnValueForMissingStub: null, ); } + +/// A class which mocks [TestNSUrlHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestNSUrlHostApi extends _i1.Mock implements _i2.TestNSUrlHostApi { + MockTestNSUrlHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + String? getAbsoluteString(int? identifier) => + (super.noSuchMethod(Invocation.method( + #getAbsoluteString, + [identifier], + )) as String?); +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index 6200b8dbcadf..53f0a263c74a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index 50e09560ed19..e6e14c168d22 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 9eab6dd9a3db..3ea029f0b66e 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 b7b729a97926..8e02a293c571 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 @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:math'; // TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231) // ignore: unnecessary_import @@ -23,6 +24,7 @@ import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; import 'webkit_webview_controller_test.mocks.dart'; @GenerateMocks([ + NSUrl, UIScrollView, WKPreferences, WKUserContentController, @@ -937,6 +939,71 @@ void main() { expect(callbackProgress, 0); }); + test('setPlatformNavigationDelegate onUrlChange', () async { + final MockWKWebView mockWebView = MockWKWebView(); + + late final void Function( + String keyPath, + NSObject object, + Map change, + ) webViewObserveValue; + + final WebKitWebViewController controller = createControllerWithMocks( + createMockWebView: ( + _, { + void Function( + String keyPath, + NSObject object, + Map change, + )? + observeValue, + }) { + webViewObserveValue = observeValue!; + return mockWebView; + }, + ); + + verify( + mockWebView.addObserver( + mockWebView, + keyPath: 'URL', + options: { + NSKeyValueObservingOptions.newValue, + }, + ), + ); + + final WebKitNavigationDelegate navigationDelegate = + WebKitNavigationDelegate( + const WebKitNavigationDelegateCreationParams( + webKitProxy: WebKitProxy( + createNavigationDelegate: CapturingNavigationDelegate.new, + createUIDelegate: WKUIDelegate.detached, + ), + ), + ); + + final Completer urlChangeCompleter = Completer(); + navigationDelegate.setOnUrlChange( + (UrlChange change) => urlChangeCompleter.complete(change), + ); + + await controller.setPlatformNavigationDelegate(navigationDelegate); + + final MockNSUrl mockNSUrl = MockNSUrl(); + when(mockNSUrl.getAbsoluteString()).thenAnswer((_) { + return Future.value('https://www.google.com'); + }); + webViewObserveValue( + 'URL', + mockWebView, + {NSKeyValueChangeKey.newValue: mockNSUrl}, + ); + + final UrlChange urlChange = await urlChangeCompleter.future; + expect(urlChange.url, 'https://www.google.com'); + }); + test('webViewIdentifier', () { final InstanceManager instanceManager = InstanceManager( onWeakReferenceRemoved: (_) {}, 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 288105c0067e..0bf094d6096a 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,17 +1,17 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/webkit_webview_controller_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:math' as _i2; -import 'dart:ui' as _i6; +import 'dart:async' as _i6; +import 'dart:math' as _i3; +import 'dart:ui' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' - as _i7; -import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i3; -import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4; + as _i2; +import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i4; +import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i5; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -24,9 +24,8 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakePoint_0 extends _i1.SmartFake - implements _i2.Point { - _FakePoint_0( +class _FakeNSObject_0 extends _i1.SmartFake implements _i2.NSObject { + _FakeNSObject_0( Object parent, Invocation parentInvocation, ) : super( @@ -35,8 +34,9 @@ class _FakePoint_0 extends _i1.SmartFake ); } -class _FakeUIScrollView_1 extends _i1.SmartFake implements _i3.UIScrollView { - _FakeUIScrollView_1( +class _FakePoint_1 extends _i1.SmartFake + implements _i3.Point { + _FakePoint_1( Object parent, Invocation parentInvocation, ) : super( @@ -45,8 +45,8 @@ class _FakeUIScrollView_1 extends _i1.SmartFake implements _i3.UIScrollView { ); } -class _FakeWKPreferences_2 extends _i1.SmartFake implements _i4.WKPreferences { - _FakeWKPreferences_2( +class _FakeUIScrollView_2 extends _i1.SmartFake implements _i4.UIScrollView { + _FakeUIScrollView_2( Object parent, Invocation parentInvocation, ) : super( @@ -55,9 +55,8 @@ class _FakeWKPreferences_2 extends _i1.SmartFake implements _i4.WKPreferences { ); } -class _FakeWKUserContentController_3 extends _i1.SmartFake - implements _i4.WKUserContentController { - _FakeWKUserContentController_3( +class _FakeWKPreferences_3 extends _i1.SmartFake implements _i5.WKPreferences { + _FakeWKPreferences_3( Object parent, Invocation parentInvocation, ) : super( @@ -66,9 +65,9 @@ class _FakeWKUserContentController_3 extends _i1.SmartFake ); } -class _FakeWKHttpCookieStore_4 extends _i1.SmartFake - implements _i4.WKHttpCookieStore { - _FakeWKHttpCookieStore_4( +class _FakeWKUserContentController_4 extends _i1.SmartFake + implements _i5.WKUserContentController { + _FakeWKUserContentController_4( Object parent, Invocation parentInvocation, ) : super( @@ -77,9 +76,9 @@ class _FakeWKHttpCookieStore_4 extends _i1.SmartFake ); } -class _FakeWKWebsiteDataStore_5 extends _i1.SmartFake - implements _i4.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_5( +class _FakeWKHttpCookieStore_5 extends _i1.SmartFake + implements _i5.WKHttpCookieStore { + _FakeWKHttpCookieStore_5( Object parent, Invocation parentInvocation, ) : super( @@ -88,9 +87,9 @@ class _FakeWKWebsiteDataStore_5 extends _i1.SmartFake ); } -class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake - implements _i4.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_6( +class _FakeWKWebsiteDataStore_6 extends _i1.SmartFake + implements _i5.WKWebsiteDataStore { + _FakeWKWebsiteDataStore_6( Object parent, Invocation parentInvocation, ) : super( @@ -99,8 +98,9 @@ class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake ); } -class _FakeWKWebView_7 extends _i1.SmartFake implements _i4.WKWebView { - _FakeWKWebView_7( +class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake + implements _i5.WKWebViewConfiguration { + _FakeWKWebViewConfiguration_7( Object parent, Invocation parentInvocation, ) : super( @@ -109,85 +109,159 @@ class _FakeWKWebView_7 extends _i1.SmartFake implements _i4.WKWebView { ); } +class _FakeWKWebView_8 extends _i1.SmartFake implements _i5.WKWebView { + _FakeWKWebView_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [NSUrl]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockNSUrl extends _i1.Mock implements _i2.NSUrl { + MockNSUrl() { + _i1.throwOnMissingStub(this); + } + + @override + _i6.Future getAbsoluteString() => (super.noSuchMethod( + Invocation.method( + #getAbsoluteString, + [], + ), + returnValue: _i6.Future.value(), + ) as _i6.Future); + @override + _i2.NSObject copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeNSObject_0( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.NSObject); + @override + _i6.Future addObserver( + _i2.NSObject? observer, { + required String? keyPath, + required Set<_i2.NSKeyValueObservingOptions>? options, + }) => + (super.noSuchMethod( + Invocation.method( + #addObserver, + [observer], + { + #keyPath: keyPath, + #options: options, + }, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + @override + _i6.Future removeObserver( + _i2.NSObject? observer, { + required String? keyPath, + }) => + (super.noSuchMethod( + Invocation.method( + #removeObserver, + [observer], + {#keyPath: keyPath}, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); +} + /// A class which mocks [UIScrollView]. /// /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable -class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { +class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView { MockUIScrollView() { _i1.throwOnMissingStub(this); } @override - _i5.Future<_i2.Point> getContentOffset() => (super.noSuchMethod( + _i6.Future<_i3.Point> getContentOffset() => (super.noSuchMethod( Invocation.method( #getContentOffset, [], ), - returnValue: _i5.Future<_i2.Point>.value(_FakePoint_0( + returnValue: _i6.Future<_i3.Point>.value(_FakePoint_1( this, Invocation.method( #getContentOffset, [], ), )), - ) as _i5.Future<_i2.Point>); + ) as _i6.Future<_i3.Point>); @override - _i5.Future scrollBy(_i2.Point? offset) => (super.noSuchMethod( + _i6.Future scrollBy(_i3.Point? offset) => (super.noSuchMethod( Invocation.method( #scrollBy, [offset], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setContentOffset(_i2.Point? offset) => + _i6.Future setContentOffset(_i3.Point? offset) => (super.noSuchMethod( Invocation.method( #setContentOffset, [offset], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i3.UIScrollView copy() => (super.noSuchMethod( + _i4.UIScrollView copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeUIScrollView_1( + returnValue: _FakeUIScrollView_2( this, Invocation.method( #copy, [], ), ), - ) as _i3.UIScrollView); + ) as _i4.UIScrollView); @override - _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( + _i6.Future setBackgroundColor(_i7.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod( + _i6.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( #setOpaque, [opaque], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -198,12 +272,12 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -212,48 +286,48 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [WKPreferences]. /// /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable -class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { +class MockWKPreferences extends _i1.Mock implements _i5.WKPreferences { MockWKPreferences() { _i1.throwOnMissingStub(this); } @override - _i5.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( + _i6.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( Invocation.method( #setJavaScriptEnabled, [enabled], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i4.WKPreferences copy() => (super.noSuchMethod( + _i5.WKPreferences copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKPreferences_2( + returnValue: _FakeWKPreferences_3( this, Invocation.method( #copy, [], ), ), - ) as _i4.WKPreferences); + ) as _i5.WKPreferences); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -264,12 +338,12 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -278,9 +352,9 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [WKUserContentController]. @@ -288,14 +362,14 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable class MockWKUserContentController extends _i1.Mock - implements _i4.WKUserContentController { + implements _i5.WKUserContentController { MockWKUserContentController() { _i1.throwOnMissingStub(this); } @override - _i5.Future addScriptMessageHandler( - _i4.WKScriptMessageHandler? handler, + _i6.Future addScriptMessageHandler( + _i5.WKScriptMessageHandler? handler, String? name, ) => (super.noSuchMethod( @@ -306,66 +380,66 @@ class MockWKUserContentController extends _i1.Mock name, ], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeScriptMessageHandler(String? name) => + _i6.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( Invocation.method( #removeScriptMessageHandler, [name], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( + _i6.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( Invocation.method( #removeAllScriptMessageHandlers, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future addUserScript(_i4.WKUserScript? userScript) => + _i6.Future addUserScript(_i5.WKUserScript? userScript) => (super.noSuchMethod( Invocation.method( #addUserScript, [userScript], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeAllUserScripts() => (super.noSuchMethod( + _i6.Future removeAllUserScripts() => (super.noSuchMethod( Invocation.method( #removeAllUserScripts, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i4.WKUserContentController copy() => (super.noSuchMethod( + _i5.WKUserContentController copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKUserContentController_3( + returnValue: _FakeWKUserContentController_4( this, Invocation.method( #copy, [], ), ), - ) as _i4.WKUserContentController); + ) as _i5.WKUserContentController); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -376,12 +450,12 @@ class MockWKUserContentController extends _i1.Mock #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -390,9 +464,9 @@ class MockWKUserContentController extends _i1.Mock [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -400,22 +474,22 @@ class MockWKUserContentController extends _i1.Mock /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable class MockWKWebsiteDataStore extends _i1.Mock - implements _i4.WKWebsiteDataStore { + implements _i5.WKWebsiteDataStore { MockWKWebsiteDataStore() { _i1.throwOnMissingStub(this); } @override - _i4.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod( + _i5.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod( Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHttpCookieStore_4( + returnValue: _FakeWKHttpCookieStore_5( this, Invocation.getter(#httpCookieStore), ), - ) as _i4.WKHttpCookieStore); + ) as _i5.WKHttpCookieStore); @override - _i5.Future removeDataOfTypes( - Set<_i4.WKWebsiteDataType>? dataTypes, + _i6.Future removeDataOfTypes( + Set<_i5.WKWebsiteDataType>? dataTypes, DateTime? since, ) => (super.noSuchMethod( @@ -426,27 +500,27 @@ class MockWKWebsiteDataStore extends _i1.Mock since, ], ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i4.WKWebsiteDataStore copy() => (super.noSuchMethod( + _i5.WKWebsiteDataStore copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebsiteDataStore_5( + returnValue: _FakeWKWebsiteDataStore_6( this, Invocation.method( #copy, [], ), ), - ) as _i4.WKWebsiteDataStore); + ) as _i5.WKWebsiteDataStore); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -457,12 +531,12 @@ class MockWKWebsiteDataStore extends _i1.Mock #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -471,84 +545,84 @@ class MockWKWebsiteDataStore extends _i1.Mock [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [WKWebView]. /// /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable -class MockWKWebView extends _i1.Mock implements _i4.WKWebView { +class MockWKWebView extends _i1.Mock implements _i5.WKWebView { MockWKWebView() { _i1.throwOnMissingStub(this); } @override - _i4.WKWebViewConfiguration get configuration => (super.noSuchMethod( + _i5.WKWebViewConfiguration get configuration => (super.noSuchMethod( Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_6( + returnValue: _FakeWKWebViewConfiguration_7( this, Invocation.getter(#configuration), ), - ) as _i4.WKWebViewConfiguration); + ) as _i5.WKWebViewConfiguration); @override - _i3.UIScrollView get scrollView => (super.noSuchMethod( + _i4.UIScrollView get scrollView => (super.noSuchMethod( Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_1( + returnValue: _FakeUIScrollView_2( this, Invocation.getter(#scrollView), ), - ) as _i3.UIScrollView); + ) as _i4.UIScrollView); @override - _i5.Future setUIDelegate(_i4.WKUIDelegate? delegate) => + _i6.Future setUIDelegate(_i5.WKUIDelegate? delegate) => (super.noSuchMethod( Invocation.method( #setUIDelegate, [delegate], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setNavigationDelegate(_i4.WKNavigationDelegate? delegate) => + _i6.Future setNavigationDelegate(_i5.WKNavigationDelegate? delegate) => (super.noSuchMethod( Invocation.method( #setNavigationDelegate, [delegate], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future getUrl() => (super.noSuchMethod( + _i6.Future getUrl() => (super.noSuchMethod( Invocation.method( #getUrl, [], ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future getEstimatedProgress() => (super.noSuchMethod( + _i6.Future getEstimatedProgress() => (super.noSuchMethod( Invocation.method( #getEstimatedProgress, [], ), - returnValue: _i5.Future.value(0.0), - ) as _i5.Future); + returnValue: _i6.Future.value(0.0), + ) as _i6.Future); @override - _i5.Future loadRequest(_i7.NSUrlRequest? request) => + _i6.Future loadRequest(_i2.NSUrlRequest? request) => (super.noSuchMethod( Invocation.method( #loadRequest, [request], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future loadHtmlString( + _i6.Future loadHtmlString( String? string, { String? baseUrl, }) => @@ -558,11 +632,11 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { [string], {#baseUrl: baseUrl}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future loadFileUrl( + _i6.Future loadFileUrl( String? url, { required String? readAccessUrl, }) => @@ -572,134 +646,134 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { [url], {#readAccessUrl: readAccessUrl}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( + _i6.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( #loadFlutterAsset, [key], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future canGoBack() => (super.noSuchMethod( + _i6.Future canGoBack() => (super.noSuchMethod( Invocation.method( #canGoBack, [], ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future canGoForward() => (super.noSuchMethod( + _i6.Future canGoForward() => (super.noSuchMethod( Invocation.method( #canGoForward, [], ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future goBack() => (super.noSuchMethod( + _i6.Future goBack() => (super.noSuchMethod( Invocation.method( #goBack, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future goForward() => (super.noSuchMethod( + _i6.Future goForward() => (super.noSuchMethod( Invocation.method( #goForward, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future reload() => (super.noSuchMethod( + _i6.Future reload() => (super.noSuchMethod( Invocation.method( #reload, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future getTitle() => (super.noSuchMethod( + _i6.Future getTitle() => (super.noSuchMethod( Invocation.method( #getTitle, [], ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setAllowsBackForwardNavigationGestures(bool? allow) => + _i6.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( Invocation.method( #setAllowsBackForwardNavigationGestures, [allow], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( + _i6.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( #setCustomUserAgent, [userAgent], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future evaluateJavaScript(String? javaScriptString) => + _i6.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( Invocation.method( #evaluateJavaScript, [javaScriptString], ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i4.WKWebView copy() => (super.noSuchMethod( + _i5.WKWebView copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebView_7( + returnValue: _FakeWKWebView_8( this, Invocation.method( #copy, [], ), ), - ) as _i4.WKWebView); + ) as _i5.WKWebView); @override - _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( + _i6.Future setBackgroundColor(_i7.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod( + _i6.Future setOpaque(bool? opaque) => (super.noSuchMethod( Invocation.method( #setOpaque, [opaque], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -710,12 +784,12 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -724,9 +798,9 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -734,75 +808,75 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable class MockWKWebViewConfiguration extends _i1.Mock - implements _i4.WKWebViewConfiguration { + implements _i5.WKWebViewConfiguration { MockWKWebViewConfiguration() { _i1.throwOnMissingStub(this); } @override - _i4.WKUserContentController get userContentController => (super.noSuchMethod( + _i5.WKUserContentController get userContentController => (super.noSuchMethod( Invocation.getter(#userContentController), - returnValue: _FakeWKUserContentController_3( + returnValue: _FakeWKUserContentController_4( this, Invocation.getter(#userContentController), ), - ) as _i4.WKUserContentController); + ) as _i5.WKUserContentController); @override - _i4.WKPreferences get preferences => (super.noSuchMethod( + _i5.WKPreferences get preferences => (super.noSuchMethod( Invocation.getter(#preferences), - returnValue: _FakeWKPreferences_2( + returnValue: _FakeWKPreferences_3( this, Invocation.getter(#preferences), ), - ) as _i4.WKPreferences); + ) as _i5.WKPreferences); @override - _i4.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod( + _i5.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod( Invocation.getter(#websiteDataStore), - returnValue: _FakeWKWebsiteDataStore_5( + returnValue: _FakeWKWebsiteDataStore_6( this, Invocation.getter(#websiteDataStore), ), - ) as _i4.WKWebsiteDataStore); + ) as _i5.WKWebsiteDataStore); @override - _i5.Future setAllowsInlineMediaPlayback(bool? allow) => + _i6.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( Invocation.method( #setAllowsInlineMediaPlayback, [allow], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future setMediaTypesRequiringUserActionForPlayback( - Set<_i4.WKAudiovisualMediaType>? types) => + _i6.Future setMediaTypesRequiringUserActionForPlayback( + Set<_i5.WKAudiovisualMediaType>? types) => (super.noSuchMethod( Invocation.method( #setMediaTypesRequiringUserActionForPlayback, [types], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i4.WKWebViewConfiguration copy() => (super.noSuchMethod( + _i5.WKWebViewConfiguration copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWKWebViewConfiguration_6( + returnValue: _FakeWKWebViewConfiguration_7( this, Invocation.method( #copy, [], ), ), - ) as _i4.WKWebViewConfiguration); + ) as _i5.WKWebViewConfiguration); @override - _i5.Future addObserver( - _i7.NSObject? observer, { + _i6.Future addObserver( + _i2.NSObject? observer, { required String? keyPath, - required Set<_i7.NSKeyValueObservingOptions>? options, + required Set<_i2.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -813,12 +887,12 @@ class MockWKWebViewConfiguration extends _i1.Mock #options: options, }, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future removeObserver( - _i7.NSObject? observer, { + _i6.Future removeObserver( + _i2.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -827,7 +901,7 @@ class MockWKWebViewConfiguration extends _i1.Mock [observer], {#keyPath: keyPath}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.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 c552d96ca316..9935685c3b02 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 0f48af4d5daa..89ce29a97310 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes From 9579d25b42d0caa867a9741fd27091a2938b184b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 26 Feb 2023 20:09:31 -0500 Subject: [PATCH 04/15] app facing --- .../webview_flutter/CHANGELOG.md | 4 + .../webview_flutter_test.dart | 26 + .../webview_flutter/example/lib/main.dart | 3 + .../webview_flutter/example/pubspec.yaml | 9 + .../example/test/main_test.dart | 3 + .../lib/src/navigation_delegate.dart | 15 + .../webview_flutter/lib/webview_flutter.dart | 1 + .../webview_flutter/pubspec.yaml | 11 +- .../test/navigation_delegate_test.dart | 12 + .../test/navigation_delegate_test.mocks.dart | 10 + .../test/webview_controller_test.mocks.dart | 10 + .../test/webview_flutter_test.dart | 2 + .../example/ios/RunnerTests/FWFURLTests.m | 22 +- .../ios/Classes/FLTWebViewFlutterPlugin.m | 6 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 416 ++-- .../ios/Classes/FWFGeneratedWebKitApis.m | 1760 ++++++++++------- .../ios/Classes/FWFObjectHostApi.m | 34 +- .../lib/src/common/web_kit.g.dart | 696 ++++--- .../lib/src/foundation/foundation.dart | 7 +- .../test/src/common/test_web_kit.g.dart | 621 +++--- 20 files changed, 2200 insertions(+), 1468 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md index 820aced37d83..2d80d6fe0995 100644 --- a/packages/webview_flutter/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.1.0 + +* Adds support to track URL changes. See `NavigationDelegate(onUrlChange)`. + ## 4.0.5 * Updates links for the merge of flutter/plugins into flutter/packages. diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart index 7763327df582..2be02b6a6aed 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart @@ -706,6 +706,32 @@ Future main() async { final String? currentUrl = await controller.currentUrl(); expect(currentUrl, secondaryUrl); }); + + testWidgets('can receive url changes', (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final WebViewController controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + )) + ..loadRequest(Uri.parse(blankPageEncoded)); + + await tester.pumpWidget(WebViewWidget(controller: controller)); + + await pageLoaded.future; + + final Completer urlChangeCompleter = Completer(); + await controller.setNavigationDelegate(NavigationDelegate( + onUrlChange: (UrlChange change) { + urlChangeCompleter.complete(change.url); + }, + )); + + await controller.runJavaScript('location.href = "$primaryUrl"'); + + await expectLater(urlChangeCompleter.future, completion(primaryUrl)); + }); }); testWidgets('target _blank opens in same window', diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart index ec1ce4eef16c..9cbfc01de56e 100644 --- a/packages/webview_flutter/webview_flutter/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart @@ -136,6 +136,9 @@ Page resource error: debugPrint('allowing navigation to ${request.url}'); return NavigationDecision.navigate; }, + onUrlChange: (UrlChange change) { + debugPrint('url change to ${change.url}'); + }, ), ) ..addJavaScriptChannel( diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index 4d8d7889d733..8830d9b67982 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -38,3 +38,12 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_android: + path: ../../../webview_flutter/webview_flutter_android + webview_flutter_platform_interface: + path: ../../../webview_flutter/webview_flutter_platform_interface + webview_flutter_wkwebview: + path: ../../../webview_flutter/webview_flutter_wkwebview diff --git a/packages/webview_flutter/webview_flutter/example/test/main_test.dart b/packages/webview_flutter/webview_flutter/example/test/main_test.dart index 7857022c14a0..b1f36d364abd 100644 --- a/packages/webview_flutter/webview_flutter/example/test/main_test.dart +++ b/packages/webview_flutter/webview_flutter/example/test/main_test.dart @@ -113,4 +113,7 @@ class FakeNavigationDelegate extends PlatformNavigationDelegate { Future setOnWebResourceError( WebResourceErrorCallback onWebResourceError, ) async {} + + @override + Future setOnUrlChange(UrlChangeCallback onUrlChange) async {} } 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 3237fa41c0bb..f7ae5ecf2697 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -36,6 +36,10 @@ import 'webview_controller.dart'; /// ``` class NavigationDelegate { /// Constructs a [NavigationDelegate]. + /// + /// {@template webview_fluttter.navigation_delegate} + /// `onUrlChange`: invoked when the underlying web view changes to a new url. + /// {@endtemplate} NavigationDelegate({ FutureOr Function(NavigationRequest request)? onNavigationRequest, @@ -43,6 +47,7 @@ class NavigationDelegate { void Function(String url)? onPageFinished, void Function(int progress)? onProgress, void Function(WebResourceError error)? onWebResourceError, + void Function(UrlChange change)? onUrlChange, }) : this.fromPlatformCreationParams( const PlatformNavigationDelegateCreationParams(), onNavigationRequest: onNavigationRequest, @@ -81,6 +86,8 @@ class NavigationDelegate { /// ); /// ``` /// {@endtemplate} + /// + /// {@macro webview_fluttter.navigation_delegate} NavigationDelegate.fromPlatformCreationParams( PlatformNavigationDelegateCreationParams params, { FutureOr Function(NavigationRequest request)? @@ -89,6 +96,7 @@ class NavigationDelegate { void Function(String url)? onPageFinished, void Function(int progress)? onProgress, void Function(WebResourceError error)? onWebResourceError, + void Function(UrlChange change)? onUrlChange, }) : this.fromPlatform( PlatformNavigationDelegate(params), onNavigationRequest: onNavigationRequest, @@ -96,9 +104,12 @@ class NavigationDelegate { onPageFinished: onPageFinished, onProgress: onProgress, onWebResourceError: onWebResourceError, + onUrlChange: onUrlChange, ); /// Constructs a [NavigationDelegate] from a specific platform implementation. + /// + /// {@macro webview_fluttter.navigation_delegate} NavigationDelegate.fromPlatform( this.platform, { this.onNavigationRequest, @@ -106,6 +117,7 @@ class NavigationDelegate { this.onPageFinished, this.onProgress, this.onWebResourceError, + void Function(UrlChange change)? onUrlChange, }) { if (onNavigationRequest != null) { platform.setOnNavigationRequest(onNavigationRequest!); @@ -122,6 +134,9 @@ class NavigationDelegate { if (onWebResourceError != null) { platform.setOnWebResourceError(onWebResourceError!); } + if (onUrlChange != null) { + platform.setOnUrlChange(onUrlChange); + } } /// Implementation of [PlatformNavigationDelegate] for the current platform. diff --git a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart index 112966d47760..4c14dcd4ef41 100644 --- a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart +++ b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart @@ -18,6 +18,7 @@ export 'package:webview_flutter_platform_interface/webview_flutter_platform_inte PlatformWebViewCookieManagerCreationParams, PlatformWebViewWidgetCreationParams, ProgressCallback, + UrlChange, WebResourceError, WebResourceErrorCallback, WebResourceErrorType, diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index d6860f615ce9..e1040bbdacf2 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.0.5 +version: 4.1.0 environment: sdk: ">=2.17.0 <3.0.0" @@ -31,3 +31,12 @@ dev_dependencies: sdk: flutter mockito: ^5.3.2 plugin_platform_interface: ^2.1.3 + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_android: + path: ../../webview_flutter/webview_flutter_android + webview_flutter_platform_interface: + path: ../../webview_flutter/webview_flutter_platform_interface + webview_flutter_wkwebview: + path: ../../webview_flutter/webview_flutter_wkwebview \ No newline at end of file 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 839454eaa605..ffd97718bd40 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart @@ -75,6 +75,18 @@ void main() { verify(delegate.platform.setOnWebResourceError(onWebResourceError)); }); + + test('onUrlChange', () async { + WebViewPlatform.instance = TestWebViewPlatform(); + + void onUrlChange(UrlChange change) {} + + final NavigationDelegate delegate = NavigationDelegate( + onUrlChange: onUrlChange, + ); + + verify(delegate.platform.setOnUrlChange(onUrlChange)); + }); }); } 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 a7ac41e558c3..c7d306905eed 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 @@ -228,4 +228,14 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override + _i8.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => + (super.noSuchMethod( + Invocation.method( + #setOnUrlChange, + [onUrlChange], + ), + 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 2bb1ef691321..aad6b2d81a0b 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 @@ -414,4 +414,14 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override + _i5.Future setOnUrlChange(_i6.UrlChangeCallback? onUrlChange) => + (super.noSuchMethod( + Invocation.method( + #setOnUrlChange, + [onUrlChange], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart index 68b60ec82896..32f30b159a46 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart @@ -41,6 +41,8 @@ void main() { main_file.WebViewCookie; // ignore: unnecessary_statements main_file.WebResourceErrorType; + // ignore: unnecessary_statements + main_file.UrlChange; }); }); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m index 9f5c58e917b4..64770bcdf602 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m @@ -15,14 +15,14 @@ @implementation FWFURLTests - (void)testAbsoluteString { NSURL *mockUrl = OCMClassMock([NSURL class]); OCMStub([mockUrl absoluteString]).andReturn(@"https://www.google.com"); - + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockUrl withIdentifier:0]; - + FWFURLHostApiImpl *hostApi = [[FWFURLHostApiImpl alloc] - initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) - instanceManager:instanceManager]; - + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + FlutterError *error; XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:@(0) error:&error], @"https://www.google.com"); @@ -32,16 +32,16 @@ - (void)testAbsoluteString { - (void)testFlutterApiCreate { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFURLFlutterApiImpl *flutterApi = [[FWFURLFlutterApiImpl alloc] - initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) - instanceManager:instanceManager]; - + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; + flutterApi.api = OCMClassMock([FWFNSUrlFlutterApi class]); - + NSURL *url = [[NSURL alloc] initWithString:@"https://www.google.com"]; [flutterApi create:url completion:^(NSError *error){ - }]; - + }]; + long identifier = [instanceManager identifierWithStrongReferenceForInstance:url]; OCMVerify([flutterApi.api createWithIdentifier:@(identifier) completion:OCMOCK_ANY]); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m index 0c456a54a778..d850fdc38794 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m @@ -101,9 +101,9 @@ + (void)registerWithRegistrar:(NSObject *)registrar { FWFWKWebViewHostApiSetup(registrar.messenger, [[FWFWebViewHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFNSUrlHostApiSetup(registrar.messenger, - [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger - instanceManager:instanceManager]); + FWFNSUrlHostApiSetup(registrar.messenger, + [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger + instanceManager:instanceManager]); FWFWebViewFactory *webviewFactory = [[FWFWebViewFactory alloc] initWithManager:instanceManager]; [registrar registerViewFactory:webviewFactory withId:@"plugins.flutter.io/webview"]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h index 75ff9111f285..06697019d5de 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN /// Mirror of NSKeyValueObservingOptions. /// -/// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. +/// See +/// https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumNewValue = 0, FWFNSKeyValueObservingOptionsEnumOldValue = 1, @@ -52,7 +53,8 @@ typedef NS_ENUM(NSUInteger, FWFWKUserScriptInjectionTimeEnum) { /// Mirror of WKAudiovisualMediaTypes. /// -/// See [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). +/// See +/// [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumNone = 0, FWFWKAudiovisualMediaTypeEnumAudio = 1, @@ -62,7 +64,8 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { /// Mirror of WKWebsiteDataTypes. /// -/// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. +/// See +/// https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumCookies = 0, FWFWKWebsiteDataTypeEnumMemoryCache = 1, @@ -105,31 +108,38 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// An object that contains information about an action that causes navigation /// to occur. /// -/// Wraps [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +/// Wraps +/// [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// A link activation. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. FWFWKNavigationTypeLinkActivated = 0, /// A request to submit a form. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. FWFWKNavigationTypeSubmitted = 1, /// A request for the frame’s next or previous item. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. FWFWKNavigationTypeBackForward = 2, /// A request to reload the webpage. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. FWFWKNavigationTypeReload = 3, /// A request to resubmit a form. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. FWFWKNavigationTypeFormResubmitted = 4, /// A navigation request that originates for some other reason. /// - /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. FWFWKNavigationTypeOther = 5, }; @@ -205,13 +215,13 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString * url; -@property(nonatomic, copy, nullable) NSString * httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; -@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString *url; +@property(nonatomic, copy, nullable) NSString *httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; +@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; @end /// Mirror of WKUserScript. @@ -221,11 +231,11 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString * source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; -@property(nonatomic, strong) NSNumber * isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString *source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; +@property(nonatomic, strong) NSNumber *isMainFrameOnly; @end /// Mirror of WKNavigationAction. @@ -235,10 +245,10 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame - navigationType:(FWFWKNavigationType)navigationType; -@property(nonatomic, strong) FWFNSUrlRequestData * request; -@property(nonatomic, strong) FWFWKFrameInfoData * targetFrame; + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType; +@property(nonatomic, strong) FWFNSUrlRequestData *request; +@property(nonatomic, strong) FWFWKFrameInfoData *targetFrame; @property(nonatomic, assign) FWFWKNavigationType navigationType; @end @@ -249,7 +259,7 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber * isMainFrame; +@property(nonatomic, strong) NSNumber *isMainFrame; @end /// Mirror of NSError. @@ -259,11 +269,11 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription; -@property(nonatomic, strong) NSNumber * code; -@property(nonatomic, copy) NSString * domain; -@property(nonatomic, copy) NSString * localizedDescription; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription; +@property(nonatomic, strong) NSNumber *code; +@property(nonatomic, copy) NSString *domain; +@property(nonatomic, copy) NSString *localizedDescription; @end /// Mirror of WKScriptMessage. @@ -272,10 +282,9 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name - body:(id )body; -@property(nonatomic, copy) NSString * name; -@property(nonatomic, strong) id body; ++ (instancetype)makeWithName:(NSString *)name body:(id)body; +@property(nonatomic, copy) NSString *name; +@property(nonatomic, strong) id body; @end /// Mirror of NSHttpCookieData. @@ -285,9 +294,9 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray * propertyKeys; -@property(nonatomic, strong) NSArray * propertyValues; + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray *propertyKeys; +@property(nonatomic, strong) NSArray *propertyValues; @end /// An object that can represent either a value supported by @@ -296,12 +305,11 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { @interface FWFObjectOrIdentifier : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithValue:(id )value - isIdentifier:(NSNumber *)isIdentifier; -@property(nonatomic, strong) id value; ++ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier; +@property(nonatomic, strong) id value; /// Whether value is an int that is used to retrieve an instance stored in an /// `InstanceManager`. -@property(nonatomic, strong) NSNumber * isIdentifier; +@property(nonatomic, strong) NSNumber *isIdentifier; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. @@ -311,12 +319,21 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -@end - -extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier + ofTypes:(NSArray *)dataTypes + modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch + completion:(void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; +@end + +extern void FWFWKWebsiteDataStoreHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @@ -325,11 +342,16 @@ NSObject *FWFUIViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier + toValue:(nullable NSNumber *)value + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier + isOpaque:(NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @@ -338,14 +360,25 @@ NSObject *FWFUIScrollViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (nullable NSArray *) + contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier + x:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @@ -355,12 +388,28 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier + isAllowed:(NSNumber *)allow + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier + forTypes: + (NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error; +@end + +extern void FWFWKWebViewConfigurationHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationFlutterApi. NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void); @@ -370,7 +419,8 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +- (void)createWithIdentifier:(NSNumber *)identifier + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @@ -379,15 +429,31 @@ NSObject *FWFWKUserContentControllerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier handlerIdentifier:(NSNumber *)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier + handlerIdentifier:(NSNumber *)handlerIdentifier + ofName:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier + name:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier + userScript:(FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFWKUserContentControllerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @@ -396,11 +462,16 @@ NSObject *FWFWKPreferencesHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier + isEnabled:(NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -412,7 +483,9 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerFlutterApi. NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void); @@ -422,7 +495,10 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion:(void(^)(NSError *_Nullable))completion; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier + userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier + message:(FWFWKScriptMessageData *)message + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @@ -434,7 +510,9 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @@ -444,12 +522,37 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier completion:(void(^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + URL:(nullable NSString *)url + completion:(void (^)(NSError *_Nullable))completion; +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + URL:(nullable NSString *)url + completion: + (void (^)(NSError *_Nullable))completion; +- (void) + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + navigationAction: + (FWFWKNavigationActionData *)navigationAction + completion: + (void (^)(FWFWKNavigationActionPolicyEnumData + *_Nullable, + NSError *_Nullable))completion; +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FWFNSErrorData *)error + completion:(void (^)(NSError *_Nullable))completion; +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FWFNSErrorData *)error + completion: + (void (^)(NSError *_Nullable))completion; +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + completion:(void (^)(NSError *_Nullable)) + completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @@ -458,12 +561,22 @@ NSObject *FWFNSObjectHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/objectivec/nsobject. @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier + observerIdentifier:(NSNumber *)observerIdentifier + keyPath:(NSString *)keyPath + options: + (NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier + observerIdentifier:(NSNumber *)observerIdentifier + keyPath:(NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. NSObject *FWFNSObjectFlutterApiGetCodec(void); @@ -473,8 +586,14 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/objectivec/nsobject. @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier keyPath:(NSString *)keyPath objectIdentifier:(NSNumber *)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void(^)(NSError *_Nullable))completion; -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier + keyPath:(NSString *)keyPath + objectIdentifier:(NSNumber *)objectIdentifier + changeKeys:(NSArray *)changeKeys + changeValues:(NSArray *)changeValues + completion:(void (^)(NSError *_Nullable))completion; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @@ -483,30 +602,65 @@ NSObject *FWFWKWebViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier + delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier + delegateIdentifier: + (nullable NSNumber *)navigationDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier + request:(FWFNSUrlRequestData *)request + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier + HTMLString:(NSString *)string + baseURL:(nullable NSString *)baseUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier + fileURL:(NSString *)url + readAccessURL:(NSString *)readAccessUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier + assetKey:(NSString *)key + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; -@end - -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier + isAllowed:(NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier + javaScriptString:(NSString *)javaScriptString + completion:(void (^)(id _Nullable, + FlutterError *_Nullable))completion; +@end + +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -518,7 +672,8 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); @@ -528,7 +683,11 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier configurationIdentifier:(NSNumber *)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(NSError *_Nullable))completion; +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + configurationIdentifier:(NSNumber *)configurationIdentifier + navigationAction:(FWFWKNavigationActionData *)navigationAction + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @@ -537,11 +696,16 @@ NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier + dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier + cookie:(FWFNSHttpCookieData *)cookie + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFNSUrlHostApi. NSObject *FWFNSUrlHostApiGetCodec(void); @@ -554,10 +718,13 @@ NSObject *FWFNSUrlHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @protocol FWFNSUrlHostApi -- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSUrlHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFNSUrlHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFNSUrlFlutterApi. NSObject *FWFNSUrlFlutterApiGetCodec(void); @@ -571,6 +738,7 @@ NSObject *FWFNSUrlFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @interface FWFNSUrlFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +- (void)createWithIdentifier:(NSNumber *)identifier + completion:(void (^)(NSError *_Nullable))completion; @end NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 6cf05cb5bad8..623731eb42f9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -12,20 +12,21 @@ static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] ]; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; } - return @[ result ?: [NSNull null] ]; + return @[ result ?: [NSNull null] ]; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list; + (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list; @@ -104,16 +105,20 @@ - (NSArray *)toList; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSKeyValueObservingOptionsEnumData fromList:list] : nil; } ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSKeyValueObservingOptionsEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -123,7 +128,7 @@ - (NSArray *)toList { @implementation FWFNSKeyValueChangeKeyEnumData + (instancetype)makeWithValue:(FWFNSKeyValueChangeKeyEnum)value { - FWFNSKeyValueChangeKeyEnumData* pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; + FWFNSKeyValueChangeKeyEnumData *pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -132,7 +137,9 @@ + (FWFNSKeyValueChangeKeyEnumData *)fromList:(NSArray *)list { pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSKeyValueChangeKeyEnumData fromList:list] : nil; } ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSKeyValueChangeKeyEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -142,16 +149,20 @@ - (NSArray *)toList { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromList:(NSArray *)list { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKUserScriptInjectionTimeEnumData fromList:list] : nil; } ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKUserScriptInjectionTimeEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -161,16 +172,20 @@ - (NSArray *)toList { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromList:(NSArray *)list { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKAudiovisualMediaTypeEnumData fromList:list] : nil; } ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKAudiovisualMediaTypeEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -180,7 +195,7 @@ - (NSArray *)toList { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -189,7 +204,9 @@ + (FWFWKWebsiteDataTypeEnumData *)fromList:(NSArray *)list { pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKWebsiteDataTypeEnumData fromList:list] : nil; } ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKWebsiteDataTypeEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -199,16 +216,20 @@ - (NSArray *)toList { @implementation FWFWKNavigationActionPolicyEnumData + (instancetype)makeWithValue:(FWFWKNavigationActionPolicyEnum)value { - FWFWKNavigationActionPolicyEnumData* pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = + [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKNavigationActionPolicyEnumData *)fromList:(NSArray *)list { - FWFWKNavigationActionPolicyEnumData *pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = + [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKNavigationActionPolicyEnumData fromList:list] : nil; } ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKNavigationActionPolicyEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -218,16 +239,20 @@ - (NSArray *)toList { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromList:(NSArray *)list { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSHttpCookiePropertyKeyEnumData fromList:list] : nil; } ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSHttpCookiePropertyKeyEnumData fromList:list] : nil; +} - (NSArray *)toList { return @[ @(self.value), @@ -237,10 +262,10 @@ - (NSArray *)toList { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -257,7 +282,9 @@ + (FWFNSUrlRequestData *)fromList:(NSArray *)list { NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } -+ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSUrlRequestData fromList:list] : nil; } ++ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSUrlRequestData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.url ?: [NSNull null]), @@ -270,9 +297,9 @@ - (NSArray *)toList { @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -282,12 +309,15 @@ + (FWFWKUserScriptData *)fromList:(NSArray *)list { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; + pigeonResult.injectionTime = + [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; pigeonResult.isMainFrameOnly = GetNullableObjectAtIndex(list, 2); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } -+ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKUserScriptData fromList:list] : nil; } ++ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKUserScriptData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.source ?: [NSNull null]), @@ -299,9 +329,9 @@ - (NSArray *)toList { @implementation FWFWKNavigationActionData + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame - navigationType:(FWFWKNavigationType)navigationType { - FWFWKNavigationActionData* pigeonResult = [[FWFWKNavigationActionData alloc] init]; + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType { + FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = request; pigeonResult.targetFrame = targetFrame; pigeonResult.navigationType = navigationType; @@ -311,12 +341,15 @@ + (FWFWKNavigationActionData *)fromList:(NSArray *)list { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 0))]; NSAssert(pigeonResult.request != nil, @""); - pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; + pigeonResult.targetFrame = + [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; NSAssert(pigeonResult.targetFrame != nil, @""); pigeonResult.navigationType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKNavigationActionData fromList:list] : nil; } ++ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKNavigationActionData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.request ? [self.request toList] : [NSNull null]), @@ -328,7 +361,7 @@ - (NSArray *)toList { @implementation FWFWKFrameInfoData + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { - FWFWKFrameInfoData* pigeonResult = [[FWFWKFrameInfoData alloc] init]; + FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } @@ -338,7 +371,9 @@ + (FWFWKFrameInfoData *)fromList:(NSArray *)list { NSAssert(pigeonResult.isMainFrame != nil, @""); return pigeonResult; } -+ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKFrameInfoData fromList:list] : nil; } ++ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKFrameInfoData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.isMainFrame ?: [NSNull null]), @@ -348,9 +383,9 @@ - (NSArray *)toList { @implementation FWFNSErrorData + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription { - FWFNSErrorData* pigeonResult = [[FWFNSErrorData alloc] init]; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription { + FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; pigeonResult.code = code; pigeonResult.domain = domain; pigeonResult.localizedDescription = localizedDescription; @@ -366,7 +401,9 @@ + (FWFNSErrorData *)fromList:(NSArray *)list { NSAssert(pigeonResult.localizedDescription != nil, @""); return pigeonResult; } -+ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSErrorData fromList:list] : nil; } ++ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSErrorData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.code ?: [NSNull null]), @@ -377,9 +414,8 @@ - (NSArray *)toList { @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name - body:(id )body { - FWFWKScriptMessageData* pigeonResult = [[FWFWKScriptMessageData alloc] init]; ++ (instancetype)makeWithName:(NSString *)name body:(id)body { + FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; return pigeonResult; @@ -391,7 +427,9 @@ + (FWFWKScriptMessageData *)fromList:(NSArray *)list { pigeonResult.body = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -+ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { return (list) ? [FWFWKScriptMessageData fromList:list] : nil; } ++ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKScriptMessageData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.name ?: [NSNull null]), @@ -402,8 +440,8 @@ - (NSArray *)toList { @implementation FWFNSHttpCookieData + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues { - FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = propertyKeys; pigeonResult.propertyValues = propertyValues; return pigeonResult; @@ -416,7 +454,9 @@ + (FWFNSHttpCookieData *)fromList:(NSArray *)list { NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } -+ (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list { return (list) ? [FWFNSHttpCookieData fromList:list] : nil; } ++ (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSHttpCookieData fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.propertyKeys ?: [NSNull null]), @@ -426,9 +466,8 @@ - (NSArray *)toList { @end @implementation FWFObjectOrIdentifier -+ (instancetype)makeWithValue:(id )value - isIdentifier:(NSNumber *)isIdentifier { - FWFObjectOrIdentifier* pigeonResult = [[FWFObjectOrIdentifier alloc] init]; ++ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier { + FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init]; pigeonResult.value = value; pigeonResult.isIdentifier = isIdentifier; return pigeonResult; @@ -440,7 +479,9 @@ + (FWFObjectOrIdentifier *)fromList:(NSArray *)list { NSAssert(pigeonResult.isIdentifier != nil, @""); return pigeonResult; } -+ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list { return (list) ? [FWFObjectOrIdentifier fromList:list] : nil; } ++ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list { + return (list) ? [FWFObjectOrIdentifier fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.value ?: [NSNull null]), @@ -452,15 +493,13 @@ - (NSArray *)toList { @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -468,13 +507,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -491,47 +528,56 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKWebsiteDataStoreHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createDefaultDataStoreWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -539,30 +585,36 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_identifier + ofTypes:arg_dataTypes + modifiedSince:arg_modificationTimeInSecondsSinceEpoch + completion:^(NSNumber *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -573,15 +625,19 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: + toValue:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -590,19 +646,20 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -611,8 +668,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -623,56 +679,65 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier + webViewIdentifier:arg_webViewIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(scrollByForScrollViewWithIdentifier:x:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -682,30 +747,34 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x y:arg_y error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_identifier + toX:arg_x + y:arg_y + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -713,15 +782,13 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -729,13 +796,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -752,26 +817,29 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKWebViewConfigurationHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -779,71 +847,87 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier + webViewIdentifier:arg_webViewIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." + @"setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: + forTypes:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier forTypes:arg_types error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier + forTypes:arg_types + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -855,7 +939,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess } @interface FWFWKWebViewConfigurationFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKWebViewConfigurationFlutterApi @@ -867,32 +951,31 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)createWithIdentifier:(NSNumber *)arg_identifier + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create" - binaryMessenger:self.binaryMessenger - codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -900,17 +983,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -927,90 +1007,113 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKUserContentControllerHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = + [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addScriptMessageHandlerForControllerWithIdentifier: + handlerIdentifier:ofName:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" + @"ofName:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier handlerIdentifier:arg_handlerIdentifier ofName:arg_name error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier + handlerIdentifier:arg_handlerIdentifier + ofName:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier name:arg_name error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier + name:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1018,40 +1121,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: + userScript:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_identifier userScript:arg_userScript error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_identifier + userScript:arg_userScript + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllUserScriptsForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1059,8 +1168,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1071,46 +1179,56 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier + isEnabled:arg_enabled + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1121,15 +1239,18 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, NS return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1137,8 +1258,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1146,15 +1266,13 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess @interface FWFWKScriptMessageHandlerFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKScriptMessageData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1162,13 +1280,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKScriptMessageHandlerFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1185,19 +1301,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKScriptMessageHandlerFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKScriptMessageHandlerFlutterApi @@ -1209,15 +1325,23 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" - binaryMessenger:self.binaryMessenger - codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], arg_message ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier + userContentControllerIdentifier: + (NSNumber *)arg_userContentControllerIdentifier + message:(FWFWKScriptMessageData *)arg_message + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" + binaryMessenger:self.binaryMessenger + codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], + arg_message ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; } @end NSObject *FWFWKNavigationDelegateHostApiGetCodec() { @@ -1226,15 +1350,18 @@ - (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifi return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1242,8 +1369,7 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1251,27 +1377,25 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen @interface FWFWKNavigationDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKNavigationDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSErrorData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 131: + + case 131: return [FWFWKNavigationActionData fromList:[self readValue]]; - - case 132: + + case 132: return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1279,29 +1403,23 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKNavigationDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKNavigationDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1318,19 +1436,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKNavigationDelegateFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKNavigationDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1342,80 +1460,124 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); - }]; -} -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + URL:(nullable NSString *)arg_url + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_url ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + URL:(nullable NSString *)arg_url + completion: + (void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_url ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void) + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + navigationAction: + (FWFWKNavigationActionData *)arg_navigationAction + completion: + (void (^)(FWFWKNavigationActionPolicyEnumData + *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_navigationAction ?: [NSNull null] + ] + reply:^(id reply) { + FWFWKNavigationActionPolicyEnumData *output = reply; + completion(output, nil); + }]; +} +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + error:(FWFNSErrorData *)arg_error + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_error ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + error:(FWFNSErrorData *)arg_error + completion: + (void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_error ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier: + (NSNumber *)arg_webViewIdentifier + completion:(void (^)(NSError *_Nullable)) + completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1423,13 +1585,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1446,26 +1606,29 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFNSObjectHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = + [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(disposeObjectWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1473,53 +1636,67 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addObserverForObjectWithIdentifier: + observerIdentifier:keyPath:options:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = + GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath options:arg_options error:&error]; + [api addObserverForObjectWithIdentifier:arg_identifier + observerIdentifier:arg_observerIdentifier + keyPath:arg_keyPath + options:arg_options + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: + observerIdentifier:keyPath:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath error:&error]; + [api removeObserverForObjectWithIdentifier:arg_identifier + observerIdentifier:arg_observerIdentifier + keyPath:arg_keyPath + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1527,18 +1704,16 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec @interface FWFNSObjectFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFObjectOrIdentifier fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1546,17 +1721,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { + } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1573,19 +1745,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFNSObjectFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; + FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = + [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFNSObjectFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFNSObjectFlutterApi @@ -1597,81 +1769,90 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier keyPath:(NSString *)arg_keyPath objectIdentifier:(NSNumber *)arg_objectIdentifier changeKeys:(NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier + keyPath:(NSString *)arg_keyPath + objectIdentifier:(NSNumber *)arg_objectIdentifier + changeKeys: + (NSArray *)arg_changeKeys + changeValues:(NSArray *)arg_changeValues + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.observeValue" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], + arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], + arg_changeValues ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSErrorData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 134: + + case 134: return [FWFObjectOrIdentifier fromList:[self readValue]]; - - case 135: + + case 135: return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; - - case 136: + + case 136: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 137: + + case 137: return [FWFWKNavigationActionData fromList:[self readValue]]; - - case 138: + + case 138: return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; - - case 139: + + case 139: return [FWFWKScriptMessageData fromList:[self readValue]]; - - case 140: + + case 140: return [FWFWKUserScriptData fromList:[self readValue]]; - - case 141: + + case 141: return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; - - case 142: + + case 142: return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1679,69 +1860,53 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { + } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) { [self writeByte:134]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:136]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:137]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:138]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:139]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:140]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:142]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1758,89 +1923,105 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKWebViewHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_uiDelegateIdentifier error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_identifier + delegateIdentifier:arg_uiDelegateIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_navigationDelegateIdentifier error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier + delegateIdentifier:arg_navigationDelegateIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(URLForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1848,39 +2029,44 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: + error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: + request:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1889,63 +2075,75 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: + HTMLString:baseURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_identifier HTMLString:arg_string baseURL:arg_baseUrl error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_identifier + HTMLString:arg_string + baseURL:arg_baseUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); + NSCAssert([api respondsToSelector:@selector + (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_identifier fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; + [api loadFileForWebViewWithIdentifier:arg_identifier + fileURL:arg_url + readAccessURL:arg_readAccessUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: + assetKey:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1954,19 +2152,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1974,19 +2173,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1994,19 +2194,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2014,19 +2215,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2034,19 +2236,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(reloadWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2054,19 +2257,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(titleForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2074,71 +2278,85 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: + userAgent:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_identifier userAgent:arg_userAgent error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_identifier + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier + javaScriptString:arg_javaScriptString + completion:^(id _Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -2149,15 +2367,18 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec()]; + codec:FWFWKUIDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2165,8 +2386,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -2174,21 +2394,19 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO @interface FWFWKUIDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKUIDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSUrlRequestData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFWKFrameInfoData fromList:[self readValue]]; - - case 130: + + case 130: return [FWFWKNavigationActionData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -2196,21 +2414,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUIDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUIDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -2227,19 +2441,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKUIDelegateFlutterApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FWFWKUIDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKUIDelegateFlutterApi @@ -2251,32 +2465,37 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier configurationIdentifier:(NSNumber *)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + configurationIdentifier:(NSNumber *)arg_configurationIdentifier + navigationAction:(FWFWKNavigationActionData *)arg_navigationAction + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromList:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -2284,17 +2503,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -2311,57 +2527,66 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FWFWKHttpCookieStoreHostApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: + dataStoreIdentifier:error:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_identifier + dataStoreIdentifier:arg_websiteDataStoreIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: + cookie:completion:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_identifier + cookie:arg_cookie + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -2372,15 +2597,18 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger return sSharedObject; } -void FWFNSUrlHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFNSUrlHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString" binaryMessenger:binaryMessenger - codec:FWFNSUrlHostApiGetCodec()]; + codec:FWFNSUrlHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(absoluteStringForNSURLWithIdentifier:error:)], @"FWFNSUrlHostApi api (%@) doesn't respond to @selector(absoluteStringForNSURLWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(absoluteStringForNSURLWithIdentifier:error:)], + @"FWFNSUrlHostApi api (%@) doesn't respond to " + @"@selector(absoluteStringForNSURLWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2388,8 +2616,7 @@ void FWFNSUrlHostApiSetup(id binaryMessenger, NSObject binaryMessenger, NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFNSUrlFlutterApi @@ -2413,14 +2640,15 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)createWithIdentifier:(NSNumber *)arg_identifier + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSUrlFlutterApi.create" - binaryMessenger:self.binaryMessenger - codec:FWFNSUrlFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFNSUrlFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index c5984c9e1dcc..187db8212a23 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -42,23 +42,23 @@ - (void)observeValueForObject:(NSObject *)instance [changeKeys addObject:FWFNSKeyValueChangeKeyEnumDataFromNSKeyValueChangeKey(key)]; BOOL isIdentifier = NO; if ([self.instanceManager containsInstance:value]) { - isIdentifier = YES; - } else if (object_getClass(value) == [NSURL class]) { - FWFURLFlutterApiImpl *flutterApi = - [[FWFURLFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger - instanceManager:self.instanceManager]; - [flutterApi create:value - completion:^(NSError *error) { - NSAssert(!error, @"%@", error); - }]; - isIdentifier = YES; - } - - id returnValue = isIdentifier - ? @([self.instanceManager identifierWithStrongReferenceForInstance:value]) - : value; - [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue - isIdentifier:@(isIdentifier)]]; + isIdentifier = YES; + } else if (object_getClass(value) == [NSURL class]) { + FWFURLFlutterApiImpl *flutterApi = + [[FWFURLFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [flutterApi create:value + completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; + isIdentifier = YES; + } + + id returnValue = isIdentifier + ? @([self.instanceManager identifierWithStrongReferenceForInstance:value]) + : value; + [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue + isIdentifier:@(isIdentifier)]]; }]; NSNumber *objectIdentifier = 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 02655a495c50..e5ccd39de3aa 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 @@ -110,22 +110,27 @@ enum WKNavigationType { /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypelinkactivated?language=objc. linkActivated, + /// A request to submit a form. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformsubmitted?language=objc. submitted, + /// A request for the frame’s next or previous item. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypebackforward?language=objc. backForward, + /// A request to reload the webpage. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypereload?language=objc. reload, + /// A request to resubmit a form. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeformresubmitted?language=objc. formResubmitted, + /// A navigation request that originates for some other reason. /// /// See https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. @@ -148,8 +153,7 @@ class NSKeyValueObservingOptionsEnumData { static NSKeyValueObservingOptionsEnumData decode(Object result) { result as List; return NSKeyValueObservingOptionsEnumData( - value: NSKeyValueObservingOptionsEnum.values[result[0]! as int] -, + value: NSKeyValueObservingOptionsEnum.values[result[0]! as int], ); } } @@ -170,8 +174,7 @@ class NSKeyValueChangeKeyEnumData { static NSKeyValueChangeKeyEnumData decode(Object result) { result as List; return NSKeyValueChangeKeyEnumData( - value: NSKeyValueChangeKeyEnum.values[result[0]! as int] -, + value: NSKeyValueChangeKeyEnum.values[result[0]! as int], ); } } @@ -192,8 +195,7 @@ class WKUserScriptInjectionTimeEnumData { static WKUserScriptInjectionTimeEnumData decode(Object result) { result as List; return WKUserScriptInjectionTimeEnumData( - value: WKUserScriptInjectionTimeEnum.values[result[0]! as int] -, + value: WKUserScriptInjectionTimeEnum.values[result[0]! as int], ); } } @@ -214,8 +216,7 @@ class WKAudiovisualMediaTypeEnumData { static WKAudiovisualMediaTypeEnumData decode(Object result) { result as List; return WKAudiovisualMediaTypeEnumData( - value: WKAudiovisualMediaTypeEnum.values[result[0]! as int] -, + value: WKAudiovisualMediaTypeEnum.values[result[0]! as int], ); } } @@ -236,8 +237,7 @@ class WKWebsiteDataTypeEnumData { static WKWebsiteDataTypeEnumData decode(Object result) { result as List; return WKWebsiteDataTypeEnumData( - value: WKWebsiteDataTypeEnum.values[result[0]! as int] -, + value: WKWebsiteDataTypeEnum.values[result[0]! as int], ); } } @@ -258,8 +258,7 @@ class WKNavigationActionPolicyEnumData { static WKNavigationActionPolicyEnumData decode(Object result) { result as List; return WKNavigationActionPolicyEnumData( - value: WKNavigationActionPolicyEnum.values[result[0]! as int] -, + value: WKNavigationActionPolicyEnum.values[result[0]! as int], ); } } @@ -280,8 +279,7 @@ class NSHttpCookiePropertyKeyEnumData { static NSHttpCookiePropertyKeyEnumData decode(Object result) { result as List; return NSHttpCookiePropertyKeyEnumData( - value: NSHttpCookiePropertyKeyEnum.values[result[0]! as int] -, + value: NSHttpCookiePropertyKeyEnum.values[result[0]! as int], ); } } @@ -320,7 +318,8 @@ class NSUrlRequestData { url: result[0]! as String, httpMethod: result[1] as String?, httpBody: result[2] as Uint8List?, - allHttpHeaderFields: (result[3] as Map?)!.cast(), + allHttpHeaderFields: + (result[3] as Map?)!.cast(), ); } } @@ -354,7 +353,8 @@ class WKUserScriptData { return WKUserScriptData( source: result[0]! as String, injectionTime: result[1] != null - ? WKUserScriptInjectionTimeEnumData.decode(result[1]! as List) + ? WKUserScriptInjectionTimeEnumData.decode( + result[1]! as List) : null, isMainFrameOnly: result[2]! as bool, ); @@ -388,12 +388,9 @@ class WKNavigationActionData { static WKNavigationActionData decode(Object result) { result as List; return WKNavigationActionData( - request: NSUrlRequestData.decode(result[0]! as List) -, - targetFrame: WKFrameInfoData.decode(result[1]! as List) -, - navigationType: WKNavigationType.values[result[2]! as int] -, + request: NSUrlRequestData.decode(result[0]! as List), + targetFrame: WKFrameInfoData.decode(result[1]! as List), + navigationType: WKNavigationType.values[result[2]! as int], ); } } @@ -508,7 +505,8 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object result) { result as List; return NSHttpCookieData( - propertyKeys: (result[0] as List?)!.cast(), + propertyKeys: (result[0] as List?)! + .cast(), propertyValues: (result[1] as List?)!.cast(), ); } @@ -560,13 +558,11 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -584,12 +580,15 @@ class WKWebsiteDataStoreHostApi { static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_configurationIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -608,7 +607,8 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -628,12 +628,18 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes(int arg_identifier, List arg_dataTypes, double arg_modificationTimeInSecondsSinceEpoch) async { + Future removeDataOfTypes( + int arg_identifier, + List arg_dataTypes, + double arg_modificationTimeInSecondsSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_dataTypes, + arg_modificationTimeInSecondsSinceEpoch + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -656,7 +662,6 @@ class WKWebsiteDataStoreHostApi { } } - /// Mirror of UIView. /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @@ -674,8 +679,8 @@ class UIViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_value]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -696,8 +701,8 @@ class UIViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_opaque]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_opaque]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -715,7 +720,6 @@ class UIViewHostApi { } } - /// Mirror of UIScrollView. /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @@ -729,12 +733,14 @@ class UIScrollViewHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView( + int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; + await channel.send([arg_identifier, arg_webViewIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -782,8 +788,8 @@ class UIScrollViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -800,12 +806,13 @@ class UIScrollViewHostApi { } } - Future setContentOffset(int arg_identifier, double arg_x, double arg_y) async { + Future setContentOffset( + int arg_identifier, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -838,13 +845,11 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -860,7 +865,8 @@ class WKWebViewConfigurationHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _WKWebViewConfigurationHostApiCodec(); Future create(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( @@ -884,12 +890,15 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView( + int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier]) as List?; + await channel.send([arg_identifier, arg_webViewIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -906,12 +915,14 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback(int arg_identifier, bool arg_allow) async { + Future setAllowsInlineMediaPlayback( + int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_allow]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_allow]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -928,12 +939,14 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, + List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_types]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_types]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -951,7 +964,6 @@ class WKWebViewConfigurationHostApi { } } - /// Handles callbacks from an WKWebViewConfiguration instance. /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @@ -960,7 +972,8 @@ abstract class WKWebViewConfigurationFlutterApi { void create(int identifier); - static void setup(WKWebViewConfigurationFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WKWebViewConfigurationFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create', codec, @@ -970,10 +983,11 @@ abstract class WKWebViewConfigurationFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); api.create(arg_identifier!); return; }); @@ -1000,16 +1014,14 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1025,14 +1037,18 @@ class WKUserContentControllerHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_configurationIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1049,12 +1065,15 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler(int arg_identifier, int arg_handlerIdentifier, String arg_name) async { + Future addScriptMessageHandler( + int arg_identifier, int arg_handlerIdentifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_handlerIdentifier, arg_name]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_handlerIdentifier, arg_name]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1071,12 +1090,14 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler(int arg_identifier, String arg_name) async { + Future removeScriptMessageHandler( + int arg_identifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_name]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_name]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1095,7 +1116,8 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1115,12 +1137,14 @@ class WKUserContentControllerHostApi { } } - Future addUserScript(int arg_identifier, WKUserScriptData arg_userScript) async { + Future addUserScript( + int arg_identifier, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_userScript]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_userScript]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1139,7 +1163,8 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1160,7 +1185,6 @@ class WKUserContentControllerHostApi { } } - /// Mirror of WKUserPreferences. /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @@ -1174,12 +1198,15 @@ class WKPreferencesHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_configurationIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1196,12 +1223,13 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled(int arg_identifier, bool arg_enabled) async { + Future setJavaScriptEnabled( + int arg_identifier, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1219,7 +1247,6 @@ class WKPreferencesHostApi { } } - /// Mirror of WKScriptMessageHandler. /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @@ -1271,13 +1298,11 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKScriptMessageData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1286,29 +1311,38 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. abstract class WKScriptMessageHandlerFlutterApi { - static const MessageCodec codec = _WKScriptMessageHandlerFlutterApiCodec(); + static const MessageCodec codec = + _WKScriptMessageHandlerFlutterApiCodec(); - void didReceiveScriptMessage(int identifier, int userContentControllerIdentifier, WKScriptMessageData message); + void didReceiveScriptMessage(int identifier, + int userContentControllerIdentifier, WKScriptMessageData message); - static void setup(WKScriptMessageHandlerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WKScriptMessageHandlerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', codec, + 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); final int? arg_userContentControllerIdentifier = (args[1] as int?); - assert(arg_userContentControllerIdentifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); - final WKScriptMessageData? arg_message = (args[2] as WKScriptMessageData?); - assert(arg_message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, arg_userContentControllerIdentifier!, arg_message!); + assert(arg_userContentControllerIdentifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + final WKScriptMessageData? arg_message = + (args[2] as WKScriptMessageData?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); + api.didReceiveScriptMessage(arg_identifier!, + arg_userContentControllerIdentifier!, arg_message!); return; }); } @@ -1316,7 +1350,6 @@ abstract class WKScriptMessageHandlerFlutterApi { } } - /// Mirror of WKNavigationDelegate. /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @@ -1380,25 +1413,23 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSUrlRequestData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKFrameInfoData.decode(readValue(buffer)!); - - case 131: + + case 131: return WKNavigationActionData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1407,145 +1438,183 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateFlutterApiCodec(); void didFinishNavigation(int identifier, int webViewIdentifier, String? url); - void didStartProvisionalNavigation(int identifier, int webViewIdentifier, String? url); + void didStartProvisionalNavigation( + int identifier, int webViewIdentifier, String? url); - Future decidePolicyForNavigationAction(int identifier, int webViewIdentifier, WKNavigationActionData navigationAction); + Future decidePolicyForNavigationAction( + int identifier, + int webViewIdentifier, + WKNavigationActionData navigationAction); - void didFailNavigation(int identifier, int webViewIdentifier, NSErrorData error); + void didFailNavigation( + int identifier, int webViewIdentifier, NSErrorData error); - void didFailProvisionalNavigation(int identifier, int webViewIdentifier, NSErrorData error); + void didFailProvisionalNavigation( + int identifier, int webViewIdentifier, NSErrorData error); - void webViewWebContentProcessDidTerminate(int identifier, int webViewIdentifier); + void webViewWebContentProcessDidTerminate( + int identifier, int webViewIdentifier); - static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WKNavigationDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didFinishNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didStartProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = (args[2] as WKNavigationActionData?); - assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = await api.decidePolicyForNavigationAction(arg_identifier!, arg_webViewIdentifier!, arg_navigationAction!); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = + (args[2] as WKNavigationActionData?); + assert(arg_navigationAction != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); + final WKNavigationActionPolicyEnumData output = + await api.decidePolicyForNavigationAction(arg_identifier!, + arg_webViewIdentifier!, arg_navigationAction!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); + api.didFailNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); + api.didFailProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', codec, + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate(arg_identifier!, arg_webViewIdentifier!); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + api.webViewWebContentProcessDidTerminate( + arg_identifier!, arg_webViewIdentifier!); return; }); } @@ -1568,13 +1637,11 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1614,12 +1681,20 @@ class NSObjectHostApi { } } - Future addObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath, List arg_options) async { + Future addObserver( + int arg_identifier, + int arg_observerIdentifier, + String arg_keyPath, + List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath, arg_options]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_observerIdentifier, + arg_keyPath, + arg_options + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1636,12 +1711,14 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath) async { + Future removeObserver(int arg_identifier, int arg_observerIdentifier, + String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath]) as List?; + final List? replyList = await channel.send( + [arg_identifier, arg_observerIdentifier, arg_keyPath]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1677,16 +1754,14 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 129: + + case 129: return ObjectOrIdentifier.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1697,11 +1772,17 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { abstract class NSObjectFlutterApi { static const MessageCodec codec = _NSObjectFlutterApiCodec(); - void observeValue(int identifier, String keyPath, int objectIdentifier, List changeKeys, List changeValues); + void observeValue( + int identifier, + String keyPath, + int objectIdentifier, + List changeKeys, + List changeValues); void dispose(int identifier); - static void setup(NSObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NSObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, @@ -1711,19 +1792,27 @@ abstract class NSObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); final String? arg_keyPath = (args[1] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); final int? arg_objectIdentifier = (args[2] as int?); - assert(arg_objectIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); - final List? arg_changeKeys = (args[3] as List?)?.cast(); - assert(arg_changeKeys != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - final List? arg_changeValues = (args[4] as List?)?.cast(); - assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); + assert(arg_objectIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + final List? arg_changeKeys = + (args[3] as List?)?.cast(); + assert(arg_changeKeys != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + final List? arg_changeValues = + (args[4] as List?)?.cast(); + assert(arg_changeValues != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, + arg_changeKeys!, arg_changeValues!); return; }); } @@ -1737,10 +1826,11 @@ abstract class NSObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return; }); @@ -1806,55 +1896,53 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return ObjectOrIdentifier.decode(readValue(buffer)!); - - case 135: + + case 135: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKFrameInfoData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKScriptMessageData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 142: + + case 142: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1872,12 +1960,14 @@ class WKWebViewHostApi { static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create(int arg_identifier, int arg_configurationIdentifier) async { + Future create( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_configurationIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_configurationIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1894,12 +1984,14 @@ class WKWebViewHostApi { } } - Future setUIDelegate(int arg_identifier, int? arg_uiDelegateIdentifier) async { + Future setUIDelegate( + int arg_identifier, int? arg_uiDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_uiDelegateIdentifier]) as List?; + await channel.send([arg_identifier, arg_uiDelegateIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1916,12 +2008,14 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate(int arg_identifier, int? arg_navigationDelegateIdentifier) async { + Future setNavigationDelegate( + int arg_identifier, int? arg_navigationDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_navigationDelegateIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_navigationDelegateIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1987,12 +2081,13 @@ class WKWebViewHostApi { } } - Future loadRequest(int arg_identifier, NSUrlRequestData arg_request) async { + Future loadRequest( + int arg_identifier, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_request]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_request]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2009,12 +2104,14 @@ class WKWebViewHostApi { } } - Future loadHtmlString(int arg_identifier, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString( + int arg_identifier, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_string, arg_baseUrl]) as List?; + await channel.send([arg_identifier, arg_string, arg_baseUrl]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2031,12 +2128,14 @@ class WKWebViewHostApi { } } - Future loadFileUrl(int arg_identifier, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl( + int arg_identifier, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_url, arg_readAccessUrl]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_url, arg_readAccessUrl]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2057,8 +2156,8 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_key]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_key]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2217,12 +2316,14 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures(int arg_identifier, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures( + int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_allow]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_allow]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2239,12 +2340,13 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent(int arg_identifier, String? arg_userAgent) async { + Future setCustomUserAgent( + int arg_identifier, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_userAgent]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_userAgent]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2261,12 +2363,14 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript(int arg_identifier, String arg_javaScriptString) async { + Future evaluateJavaScript( + int arg_identifier, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_javaScriptString]) as List?; + await channel.send([arg_identifier, arg_javaScriptString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2284,7 +2388,6 @@ class WKWebViewHostApi { } } - /// Mirror of WKUIDelegate. /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @@ -2342,19 +2445,17 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSUrlRequestData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKFrameInfoData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKNavigationActionData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -2365,9 +2466,11 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { abstract class WKUIDelegateFlutterApi { static const MessageCodec codec = _WKUIDelegateFlutterApiCodec(); - void onCreateWebView(int identifier, int webViewIdentifier, int configurationIdentifier, WKNavigationActionData navigationAction); + void onCreateWebView(int identifier, int webViewIdentifier, + int configurationIdentifier, WKNavigationActionData navigationAction); - static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WKUIDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, @@ -2377,17 +2480,23 @@ abstract class WKUIDelegateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[2] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = (args[3] as WKNavigationActionData?); - assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, arg_configurationIdentifier!, arg_navigationAction!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = + (args[3] as WKNavigationActionData?); + assert(arg_navigationAction != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, + arg_configurationIdentifier!, arg_navigationAction!); return; }); } @@ -2413,16 +2522,14 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -2440,12 +2547,15 @@ class WKHttpCookieStoreHostApi { static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore(int arg_identifier, int arg_websiteDataStoreIdentifier) async { + Future createFromWebsiteDataStore( + int arg_identifier, int arg_websiteDataStoreIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_websiteDataStoreIdentifier]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_websiteDataStoreIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2462,12 +2572,13 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie(int arg_identifier, NSHttpCookieData arg_cookie) async { + Future setCookie( + int arg_identifier, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_cookie]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_cookie]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2485,7 +2596,6 @@ class WKHttpCookieStoreHostApi { } } - /// Host API for `NSUrl`. /// /// This class may handle instantiating and adding native object instances that @@ -2526,7 +2636,6 @@ class NSUrlHostApi { } } - /// Flutter API for `NSUrl`. /// /// This class may handle instantiating and adding Dart instances that are @@ -2549,10 +2658,11 @@ abstract class NSUrlFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null, expected non-null int.'); api.create(arg_identifier!); return; }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index c13731324b6c..94ce1c8d140c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -235,7 +235,6 @@ class NSHttpCookie { final Map properties; } - /// An object that represents the location of a resource, such as an item on a /// remote server or the path to a local file. /// @@ -249,9 +248,9 @@ class NSUrl extends NSObject { @protected NSUrl.detached({super.binaryMessenger, super.instanceManager}) : _nsUrlHostApi = NSUrlHostApiImpl( - binaryMessenger: binaryMessenger, - instanceManager: instanceManager, - ), + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), super.detached(); final NSUrlHostApiImpl _nsUrlHostApi; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart index 68c8a2a0fe79..9b9d24e38ea9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart @@ -28,13 +28,11 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -43,48 +41,60 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration(int identifier, int configurationIdentifier); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); void createDefaultDataStore(int identifier); - Future removeDataOfTypes(int identifier, List dataTypes, double modificationTimeInSecondsSinceEpoch); + Future removeDataOfTypes( + int identifier, + List dataTypes, + double modificationTimeInSecondsSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebsiteDataStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_identifier!); return []; }); @@ -92,22 +102,29 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); - final double? arg_modificationTimeInSecondsSinceEpoch = (args[2] as double?); - assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = + (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + final double? arg_modificationTimeInSecondsSinceEpoch = + (args[2] as double?); + assert(arg_modificationTimeInSecondsSinceEpoch != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_identifier!, + arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); return [output]; }); } @@ -115,7 +132,6 @@ abstract class TestWKWebsiteDataStoreHostApi { } } - /// Mirror of UIView. /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @@ -126,7 +142,8 @@ abstract class TestUIViewHostApi { void setOpaque(int identifier, bool opaque); - static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, @@ -136,10 +153,11 @@ abstract class TestUIViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_identifier!, arg_value); return []; @@ -155,12 +173,14 @@ abstract class TestUIViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_identifier!, arg_opaque!); return []; }); @@ -169,7 +189,6 @@ abstract class TestUIViewHostApi { } } - /// Mirror of UIScrollView. /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @@ -184,7 +203,8 @@ abstract class TestUIScrollViewHostApi { void setContentOffset(int identifier, double x, double y); - static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, @@ -194,12 +214,14 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return []; }); @@ -214,10 +236,11 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_identifier!); return [output]; }); @@ -232,14 +255,17 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_identifier!, arg_x!, arg_y!); return []; }); @@ -254,14 +280,17 @@ abstract class TestUIScrollViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_identifier!, arg_x!, arg_y!); return []; }); @@ -285,13 +314,11 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -300,7 +327,8 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _TestWKWebViewConfigurationHostApiCodec(); void create(int identifier); @@ -308,9 +336,11 @@ abstract class TestWKWebViewConfigurationHostApi { void setAllowsInlineMediaPlayback(int identifier, bool allow); - void setMediaTypesRequiringUserActionForPlayback(int identifier, List types); + void setMediaTypesRequiringUserActionForPlayback( + int identifier, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewConfigurationHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, @@ -320,10 +350,11 @@ abstract class TestWKWebViewConfigurationHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -331,19 +362,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return []; }); @@ -351,19 +385,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); return []; }); @@ -371,20 +408,26 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = (args[1] as List?)?.cast(); - assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback(arg_identifier!, arg_types!); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = + (args[1] as List?) + ?.cast(); + assert(arg_types != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback( + arg_identifier!, arg_types!); return []; }); } @@ -410,16 +453,14 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -428,11 +469,14 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration(int identifier, int configurationIdentifier); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); - void addScriptMessageHandler(int identifier, int handlerIdentifier, String name); + void addScriptMessageHandler( + int identifier, int handlerIdentifier, String name); void removeScriptMessageHandler(int identifier, String name); @@ -442,64 +486,77 @@ abstract class TestWKUserContentControllerHostApi { void removeAllUserScripts(int identifier); - static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerIdentifier = (args[1] as int?); - assert(arg_handlerIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler(arg_identifier!, arg_handlerIdentifier!, arg_name!); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler( + arg_identifier!, arg_handlerIdentifier!, arg_name!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_identifier!, arg_name!); return []; }); @@ -507,17 +564,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_identifier!); return []; }); @@ -525,19 +584,23 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); - assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = + (args[1] as WKUserScriptData?); + assert(arg_userScript != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_identifier!, arg_userScript!); return []; }); @@ -545,17 +608,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_identifier!); return []; }); @@ -564,34 +629,39 @@ abstract class TestWKUserContentControllerHostApi { } } - /// Mirror of WKUserPreferences. /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. abstract class TestWKPreferencesHostApi { static const MessageCodec codec = StandardMessageCodec(); - void createFromWebViewConfiguration(int identifier, int configurationIdentifier); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); void setJavaScriptEnabled(int identifier, bool enabled); - static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return []; }); } @@ -605,12 +675,14 @@ abstract class TestWKPreferencesHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); return []; }); @@ -619,7 +691,6 @@ abstract class TestWKPreferencesHostApi { } } - /// Mirror of WKScriptMessageHandler. /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @@ -628,7 +699,8 @@ abstract class TestWKScriptMessageHandlerHostApi { void create(int identifier); - static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, @@ -638,10 +710,11 @@ abstract class TestWKScriptMessageHandlerHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -650,7 +723,6 @@ abstract class TestWKScriptMessageHandlerHostApi { } } - /// Mirror of WKNavigationDelegate. /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @@ -659,7 +731,8 @@ abstract class TestWKNavigationDelegateHostApi { void create(int identifier); - static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, @@ -669,10 +742,11 @@ abstract class TestWKNavigationDelegateHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -696,13 +770,11 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -715,11 +787,13 @@ abstract class TestNSObjectHostApi { void dispose(int identifier); - void addObserver(int identifier, int observerIdentifier, String keyPath, List options); + void addObserver(int identifier, int observerIdentifier, String keyPath, + List options); void removeObserver(int identifier, int observerIdentifier, String keyPath); - static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, @@ -729,10 +803,11 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return []; }); @@ -747,17 +822,24 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = (args[3] as List?)?.cast(); - assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!, arg_options!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = + (args[3] as List?) + ?.cast(); + assert(arg_options != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_identifier!, arg_observerIdentifier!, + arg_keyPath!, arg_options!); return []; }); } @@ -771,15 +853,19 @@ abstract class TestNSObjectHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver( + arg_identifier!, arg_observerIdentifier!, arg_keyPath!); return []; }); } @@ -844,55 +930,53 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return ObjectOrIdentifier.decode(readValue(buffer)!); - - case 135: + + case 135: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKFrameInfoData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKScriptMessageData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 142: + + case 142: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -939,7 +1023,8 @@ abstract class TestWKWebViewHostApi { Future evaluateJavaScript(int identifier, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, @@ -949,12 +1034,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_identifier!, arg_configurationIdentifier!); return []; }); @@ -969,10 +1056,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); return []; @@ -988,12 +1076,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate(arg_identifier!, arg_navigationDelegateIdentifier); + api.setNavigationDelegate( + arg_identifier!, arg_navigationDelegateIdentifier); return []; }); } @@ -1007,10 +1097,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_identifier!); return [output]; }); @@ -1025,10 +1116,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_identifier!); return [output]; }); @@ -1043,12 +1135,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_identifier!, arg_request!); return []; }); @@ -1063,12 +1157,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); return []; @@ -1084,14 +1180,17 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); return []; }); @@ -1106,12 +1205,14 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_identifier!, arg_key!); return []; }); @@ -1126,10 +1227,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_identifier!); return [output]; }); @@ -1144,10 +1246,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_identifier!); return [output]; }); @@ -1162,10 +1265,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_identifier!); return []; }); @@ -1180,10 +1284,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_identifier!); return []; }); @@ -1198,10 +1303,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_identifier!); return []; }); @@ -1216,10 +1322,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_identifier!); return [output]; }); @@ -1227,20 +1334,24 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures(arg_identifier!, arg_allow!); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures( + arg_identifier!, arg_allow!); return []; }); } @@ -1254,10 +1365,11 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_identifier!, arg_userAgent); return []; @@ -1273,13 +1385,16 @@ abstract class TestWKWebViewHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript(arg_identifier!, arg_javaScriptString!); + assert(arg_javaScriptString != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript( + arg_identifier!, arg_javaScriptString!); return [output]; }); } @@ -1287,7 +1402,6 @@ abstract class TestWKWebViewHostApi { } } - /// Mirror of WKUIDelegate. /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @@ -1296,7 +1410,8 @@ abstract class TestWKUIDelegateHostApi { void create(int identifier); - static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, @@ -1306,10 +1421,11 @@ abstract class TestWKUIDelegateHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return []; }); @@ -1336,16 +1452,14 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -1354,29 +1468,36 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore(int identifier, int websiteDataStoreIdentifier); + void createFromWebsiteDataStore( + int identifier, int websiteDataStoreIdentifier); Future setCookie(int identifier, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreIdentifier = (args[1] as int?); - assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore(arg_identifier!, arg_websiteDataStoreIdentifier!); + assert(arg_websiteDataStoreIdentifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore( + arg_identifier!, arg_websiteDataStoreIdentifier!); return []; }); } @@ -1390,12 +1511,14 @@ abstract class TestWKHttpCookieStoreHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_identifier!, arg_cookie!); return []; }); @@ -1404,7 +1527,6 @@ abstract class TestWKHttpCookieStoreHostApi { } } - /// Host API for `NSUrl`. /// /// This class may handle instantiating and adding native object instances that @@ -1427,10 +1549,11 @@ abstract class TestNSUrlHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null.'); + 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null, expected non-null int.'); final String? output = api.getAbsoluteString(arg_identifier!); return [output]; }); From be6f45338e11a0a2b9086c51906da21f27d8d6c6 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 28 Feb 2023 12:20:04 -0500 Subject: [PATCH 05/15] fix unused parameter --- .../webview_flutter/lib/src/navigation_delegate.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 f7ae5ecf2697..fc06c15177f1 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -55,6 +55,7 @@ class NavigationDelegate { onPageFinished: onPageFinished, onProgress: onProgress, onWebResourceError: onWebResourceError, + onUrlChange: onUrlChange, ); /// Constructs a [NavigationDelegate] from creation params for a specific @@ -117,7 +118,7 @@ class NavigationDelegate { this.onPageFinished, this.onProgress, this.onWebResourceError, - void Function(UrlChange change)? onUrlChange, + void Function(UrlChange change)? onUrlChange, }) { if (onNavigationRequest != null) { platform.setOnNavigationRequest(onNavigationRequest!); From 9904b49d1d676a505a8d45b0282d102278409b45 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 28 Feb 2023 13:16:51 -0500 Subject: [PATCH 06/15] add history test and some fixes --- .../webview_flutter_test.dart | 31 +++++++++++++++ .../WebViewClientFlutterApiImpl.java | 15 +++++++ .../webview_flutter_test.dart | 39 +++++++++++++++++++ .../android_navigation_delegate_test.dart | 10 +++-- .../CHANGELOG.md | 2 +- .../pubspec.yaml | 2 +- .../webview_flutter_test.dart | 39 +++++++++++++++++++ .../example/ios/Runner/Info.plist | 2 - 8 files changed, 133 insertions(+), 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart index 2be02b6a6aed..b4d1c7fc0091 100644 --- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart @@ -732,6 +732,37 @@ Future main() async { await expectLater(urlChangeCompleter.future, completion(primaryUrl)); }); + + testWidgets('can receive updates to history state', + (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final NavigationDelegate navigationDelegate = NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + ); + + final WebViewController controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setNavigationDelegate(navigationDelegate) + ..loadRequest(Uri.parse(primaryUrl)); + + await tester.pumpWidget(WebViewWidget(controller: controller)); + + await pageLoaded.future; + + final Completer urlChangeCompleter = Completer(); + await controller.setNavigationDelegate(NavigationDelegate( + onUrlChange: (UrlChange change) { + urlChangeCompleter.complete(change.url); + }, + )); + + await controller.runJavaScript( + 'window.history.pushState({}, "", "secondary.txt");', + ); + + await expectLater(urlChangeCompleter.future, completion(secondaryUrl)); + }); }); testWidgets('target _blank opens in same window', diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java index 0dc0bbb82b07..7a146ef073cb 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java @@ -197,6 +197,21 @@ public void urlLoading( urlLoading(getIdentifierForClient(webViewClient), webViewIdentifier, urlArg, callback); } + /** Passes arguments from {@link WebViewClient#doUpdateVisitedHistory} to Dart. */ + public void doUpdateVisitedHistory( + WebViewClient webViewClient, + WebView webView, + String url, + boolean isReload, + Reply callback) { + final Long webViewIdentifier = instanceManager.getIdentifierForStrongReference(webView); + if (webViewIdentifier == null) { + throw new IllegalStateException("Could not find identifier for WebView."); + } + doUpdateVisitedHistory( + getIdentifierForClient(webViewClient), webViewIdentifier, url, isReload, callback); + } + private long getIdentifierForClient(WebViewClient webViewClient) { final Long identifier = instanceManager.getIdentifierForStrongReference(webViewClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index c5382d361160..e5889047cf23 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -972,6 +972,45 @@ Future main() async { await expectLater(urlChangeCompleter.future, completion(primaryUrl)); }); + + testWidgets('can receive updates to history state', + (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + )..setOnPageFinished((_) => pageLoaded.complete()); + + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ) + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setPlatformNavigationDelegate(navigationDelegate) + ..loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await pageLoaded.future; + await navigationDelegate.setOnPageFinished((_) {}); + + final Completer urlChangeCompleter = Completer(); + await navigationDelegate.setOnUrlChange((UrlChange change) { + urlChangeCompleter.complete(change.url); + }); + + await controller.runJavaScript( + 'window.history.pushState({}, "", "secondary.txt");', + ); + + await expectLater(urlChangeCompleter.future, completion(secondaryUrl)); + }); }); testWidgets('target _blank opens in same window', 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 1bf190a6938e..6462defcab35 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 @@ -442,9 +442,12 @@ void main() { final AndroidNavigationDelegate androidNavigationDelegate = AndroidNavigationDelegate(_buildCreationParams()); - late final UrlChange urlChange; - androidNavigationDelegate - .setOnUrlChange((UrlChange change) => urlChange = change); + late final AndroidUrlChange urlChange; + androidNavigationDelegate.setOnUrlChange( + (UrlChange change) { + urlChange = change as AndroidUrlChange; + }, + ); CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( android_webview.WebView.detached(), @@ -453,6 +456,7 @@ void main() { ); expect(urlChange.url, 'https://www.google.com'); + expect(urlChange.isReload, isFalse); }); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md index 31bd0968ad79..02380956fa2d 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.1.2 +## 2.1.0 * Adds support to track url changes. See `PlatformNavigationDelegate.setOnUrlChange`. diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index d03c69fcf906..da77d9790e28 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.1.2 +version: 2.1.0 environment: sdk: ">=2.12.0 <3.0.0" diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart index 4beca15ff561..afc19ef94fdd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart @@ -1038,6 +1038,45 @@ Future main() async { await expectLater(urlChangeCompleter.future, completion(primaryUrl)); }); + + testWidgets('can receive updates to history state', + (WidgetTester tester) async { + final Completer pageLoaded = Completer(); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + )..setOnPageFinished((_) => pageLoaded.complete()); + + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ) + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setPlatformNavigationDelegate(navigationDelegate) + ..loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl))); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + )); + + await pageLoaded.future; + await navigationDelegate.setOnPageFinished((_) {}); + + final Completer urlChangeCompleter = Completer(); + await navigationDelegate.setOnUrlChange((UrlChange change) { + urlChangeCompleter.complete(change.url); + }); + + await controller.runJavaScript( + 'window.history.pushState({}, "", "secondary.txt");', + ); + + await expectLater(urlChangeCompleter.future, completion(secondaryUrl)); + }); }); testWidgets('launches with gestureNavigationEnabled on iOS', diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist index 6ee44fd0e2fd..bea41604e8aa 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner/Info.plist @@ -43,7 +43,5 @@ CADisableMinimumFrameDurationOnPhone - UIApplicationSupportsIndirectInputEvents - From d3ba00377ffc73328badd49fa8e1af243971ff3c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 28 Feb 2023 13:23:58 -0500 Subject: [PATCH 07/15] undo slight mock changes --- .../test/legacy/web_kit_cookie_manager_test.mocks.dart | 2 +- .../test/legacy/web_kit_webview_widget_test.mocks.dart | 2 +- .../test/src/ui_kit/ui_kit_test.mocks.dart | 2 +- .../test/src/web_kit/web_kit_test.mocks.dart | 2 +- .../test/webkit_navigation_delegate_test.mocks.dart | 2 +- .../test/webkit_webview_cookie_manager_test.mocks.dart | 2 +- .../test/webkit_webview_widget_test.mocks.dart | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) 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 27eba93ade54..860e8dbeb4ce 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. +// in webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 a4057bf3affb..1680997d5856 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. +// in webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index 53f0a263c74a..6200b8dbcadf 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index e6e14c168d22..50e09560ed19 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 3ea029f0b66e..9eab6dd9a3db 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. +// in webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 9935685c3b02..c552d96ca316 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. +// in webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes 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 89ce29a97310..0f48af4d5daa 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,5 +1,5 @@ // Mocks generated by Mockito 5.3.2 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. +// in webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes From b49354844aa269e49299983570dedeeaa40afd3b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:22:08 -0400 Subject: [PATCH 08/15] remove dep overrides --- .../webview_flutter/example/pubspec.yaml | 11 +---------- packages/webview_flutter/webview_flutter/pubspec.yaml | 11 +---------- .../webview_flutter_android/example/pubspec.yaml | 10 +--------- .../webview_flutter_android/pubspec.yaml | 8 +------- .../webview_flutter_wkwebview/example/pubspec.yaml | 10 +--------- .../webview_flutter_wkwebview/pubspec.yaml | 8 +------- 6 files changed, 6 insertions(+), 52 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index e5c675c0d3a8..11a67247fd4d 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -29,7 +29,7 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 flutter: uses-material-design: true @@ -38,12 +38,3 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_android: - path: ../../../webview_flutter/webview_flutter_android - webview_flutter_platform_interface: - path: ../../../webview_flutter/webview_flutter_platform_interface - webview_flutter_wkwebview: - path: ../../../webview_flutter/webview_flutter_wkwebview diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index 7f71f9c615e8..85846a18e403 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -20,7 +20,7 @@ dependencies: flutter: sdk: flutter webview_flutter_android: ^3.0.0 - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 webview_flutter_wkwebview: ^3.0.0 dev_dependencies: @@ -31,12 +31,3 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 plugin_platform_interface: ^2.1.3 - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_android: - path: ../../webview_flutter/webview_flutter_android - webview_flutter_platform_interface: - path: ../../webview_flutter/webview_flutter_platform_interface - webview_flutter_wkwebview: - path: ../../webview_flutter/webview_flutter_wkwebview \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index 33e604c7e53c..8a190ff22ebb 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 dev_dependencies: espresso: ^0.2.0 @@ -35,11 +35,3 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css - - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_android: - path: ../../../webview_flutter/webview_flutter_android - webview_flutter_platform_interface: - path: ../../../webview_flutter/webview_flutter_platform_interface \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 4634a75eea77..7eb5411640e5 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -20,7 +20,7 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 dev_dependencies: build_runner: ^2.1.4 @@ -30,9 +30,3 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 pigeon: ^9.0.4 - - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_platform_interface: - path: ../../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 54479946b7a3..b1ee08223957 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter path_provider: ^2.0.6 - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 webview_flutter_wkwebview: # When depending on this package from a real application you should use: # webview_flutter: ^x.y.z @@ -34,11 +34,3 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css - - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_platform_interface: - path: ../../../webview_flutter/webview_flutter_platform_interface - webview_flutter_wkwebview: - path: ../../../webview_flutter/webview_flutter_wkwebview \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 2779a5d56849..21247e3aff1d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -20,7 +20,7 @@ dependencies: flutter: sdk: flutter path: ^1.8.0 - webview_flutter_platform_interface: ^2.0.0 + webview_flutter_platform_interface: ^2.1.0 dev_dependencies: build_runner: ^2.1.5 @@ -30,9 +30,3 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 pigeon: ^7.0.5 - - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_platform_interface: - path: ../../webview_flutter/webview_flutter_platform_interface From 08d1c2c3cb6c49e8f984d24dacb67ea85c6b5ebd Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:30:28 -0400 Subject: [PATCH 09/15] create webview on android --- .../webviewflutter/WebViewClientFlutterApiImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java index f148c93b092b..f2d696ed8a47 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java @@ -209,10 +209,10 @@ public void doUpdateVisitedHistory( String url, boolean isReload, Reply callback) { - final Long webViewIdentifier = instanceManager.getIdentifierForStrongReference(webView); - if (webViewIdentifier == null) { - throw new IllegalStateException("Could not find identifier for WebView."); - } + webViewFlutterApi.create(webView, reply -> {}); + + final Long webViewIdentifier = + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webView)); doUpdateVisitedHistory( getIdentifierForClient(webViewClient), webViewIdentifier, url, isReload, callback); } From 3946118debb1e131757ad7319a00e082ba9938e7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:35:23 -0400 Subject: [PATCH 10/15] add android and wkwebview deps back --- .../webview_flutter/webview_flutter/example/pubspec.yaml | 7 +++++++ packages/webview_flutter/webview_flutter/pubspec.yaml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index 11a67247fd4d..61a7e7398c88 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -38,3 +38,10 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_android: + path: ../../../webview_flutter/webview_flutter_android + webview_flutter_wkwebview: + path: ../../../webview_flutter/webview_flutter_wkwebview diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index 85846a18e403..e5427f610d4f 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -31,3 +31,10 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 plugin_platform_interface: ^2.1.3 + +# FOR TESTING ONLY. DO NOT MERGE. +dependency_overrides: + webview_flutter_android: + path: ../../webview_flutter/webview_flutter_android + webview_flutter_wkwebview: + path: ../../webview_flutter/webview_flutter_wkwebview From b33679bcfd9a7a0fcba5ba278c48c3da6ca2280d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:50:05 -0400 Subject: [PATCH 11/15] undo changes --- .../lib/src/android_webview_api_impls.dart | 24 ----- .../lib/src/android_webview_controller.dart | 12 --- .../web_kit_webview_widget_test.mocks.dart | 95 ++++++++++--------- ...webkit_navigation_delegate_test.mocks.dart | 3 +- 4 files changed, 50 insertions(+), 84 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index d2c81be3e269..0bc2c84c4092 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -778,30 +778,6 @@ class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); } } - - @override - void doUpdateVisitedHistory( - int instanceId, - int webViewInstanceId, - String url, - bool isReload, - ) { - final WebViewClient? instance = instanceManager - .getInstanceWithWeakReference(instanceId) as WebViewClient?; - final WebView? webViewInstance = instanceManager - .getInstanceWithWeakReference(webViewInstanceId) as WebView?; - assert( - instance != null, - 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId', - ); - assert( - webViewInstance != null, - 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId', - ); - if (instance!.doUpdateVisitedHistory != null) { - instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); - } - } } /// Host api implementation for [DownloadListener]. 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 8d8eebb77823..88a4bca84aba 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 @@ -796,18 +796,6 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { callback(AndroidUrlChange(url: url, isReload: isReload)); } }, - doUpdateVisitedHistory: ( - android_webview.WebView webView, - String url, - bool isReload, - ) { - if (weakThis.target?._onUrlChange != null) { - weakThis.target!._onUrlChange!(AndroidUrlChange( - url: url, - isReload: isReload, - )); - } - }, ); _downloadListener = (this.params as AndroidNavigationDelegateCreationParams) 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 16ced43a65fb..6f5ffe0b5acb 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 @@ -5,18 +5,19 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:math' as _i2; +import 'dart:ui' as _i6; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_platform_interface/src/legacy/types/javascript_channel.dart' - as _i8; -import 'package:webview_flutter_platform_interface/src/legacy/types/types.dart' as _i9; +import 'package:webview_flutter_platform_interface/src/legacy/types/types.dart' + as _i10; import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart' - as _i7; + as _i8; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' - as _i6; + as _i7; import 'package:webview_flutter_wkwebview/src/legacy/web_kit_webview_widget.dart' - as _i10; + as _i11; import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i3; import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4; @@ -205,7 +206,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { ), ) as _i3.UIScrollView); @override - _i5.Future setBackgroundColor(dynamic color) => (super.noSuchMethod( + _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], @@ -224,9 +225,9 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { ) as _i5.Future); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -242,7 +243,7 @@ class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -282,9 +283,9 @@ class MockWKNavigationDelegate extends _i1.Mock ) as _i4.WKNavigationDelegate); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -300,7 +301,7 @@ class MockWKNavigationDelegate extends _i1.Mock ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -348,9 +349,9 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { ) as _i4.WKPreferences); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -366,7 +367,7 @@ class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -420,9 +421,9 @@ class MockWKScriptMessageHandler extends _i1.Mock ) as _i4.WKScriptMessageHandler); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -438,7 +439,7 @@ class MockWKScriptMessageHandler extends _i1.Mock ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -514,7 +515,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { returnValue: _i5.Future.value(0.0), ) as _i5.Future); @override - _i5.Future loadRequest(_i6.NSUrlRequest? request) => + _i5.Future loadRequest(_i7.NSUrlRequest? request) => (super.noSuchMethod( Invocation.method( #loadRequest, @@ -654,7 +655,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ), ) as _i4.WKWebView); @override - _i5.Future setBackgroundColor(dynamic color) => (super.noSuchMethod( + _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], @@ -673,9 +674,9 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ) as _i5.Future); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -691,7 +692,7 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -776,9 +777,9 @@ class MockWKWebViewConfiguration extends _i1.Mock ) as _i4.WKWebViewConfiguration); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -794,7 +795,7 @@ class MockWKWebViewConfiguration extends _i1.Mock ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -857,9 +858,9 @@ class MockWKWebsiteDataStore extends _i1.Mock ) as _i4.WKWebsiteDataStore); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -875,7 +876,7 @@ class MockWKWebsiteDataStore extends _i1.Mock ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -914,9 +915,9 @@ class MockWKUIDelegate extends _i1.Mock implements _i4.WKUIDelegate { ) as _i4.WKUIDelegate); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -932,7 +933,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i4.WKUIDelegate { ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -1026,9 +1027,9 @@ class MockWKUserContentController extends _i1.Mock ) as _i4.WKUserContentController); @override _i5.Future addObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, - required Set<_i6.NSKeyValueObservingOptions>? options, + required Set<_i7.NSKeyValueObservingOptions>? options, }) => (super.noSuchMethod( Invocation.method( @@ -1044,7 +1045,7 @@ class MockWKUserContentController extends _i1.Mock ) as _i5.Future); @override _i5.Future removeObserver( - _i6.NSObject? observer, { + _i7.NSObject? observer, { required String? keyPath, }) => (super.noSuchMethod( @@ -1062,16 +1063,16 @@ class MockWKUserContentController extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockJavascriptChannelRegistry extends _i1.Mock - implements _i7.JavascriptChannelRegistry { + implements _i8.JavascriptChannelRegistry { MockJavascriptChannelRegistry() { _i1.throwOnMissingStub(this); } @override - Map get channels => (super.noSuchMethod( + Map get channels => (super.noSuchMethod( Invocation.getter(#channels), - returnValue: {}, - ) as Map); + returnValue: {}, + ) as Map); @override void onJavascriptChannelMessage( String? channel, @@ -1088,7 +1089,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock returnValueForMissingStub: null, ); @override - void updateJavascriptChannelsFromSet(Set<_i8.JavascriptChannel>? channels) => + void updateJavascriptChannelsFromSet(Set<_i9.JavascriptChannel>? channels) => super.noSuchMethod( Invocation.method( #updateJavascriptChannelsFromSet, @@ -1102,7 +1103,7 @@ class MockJavascriptChannelRegistry extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockWebViewPlatformCallbacksHandler extends _i1.Mock - implements _i7.WebViewPlatformCallbacksHandler { + implements _i8.WebViewPlatformCallbacksHandler { MockWebViewPlatformCallbacksHandler() { _i1.throwOnMissingStub(this); } @@ -1148,7 +1149,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock returnValueForMissingStub: null, ); @override - void onWebResourceError(_i9.WebResourceError? error) => super.noSuchMethod( + void onWebResourceError(_i10.WebResourceError? error) => super.noSuchMethod( Invocation.method( #onWebResourceError, [error], @@ -1161,7 +1162,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockWebViewWidgetProxy extends _i1.Mock - implements _i10.WebViewWidgetProxy { + implements _i11.WebViewWidgetProxy { MockWebViewWidgetProxy() { _i1.throwOnMissingStub(this); } @@ -1171,8 +1172,8 @@ class MockWebViewWidgetProxy extends _i1.Mock _i4.WKWebViewConfiguration? configuration, { void Function( String, - _i6.NSObject, - Map<_i6.NSKeyValueChangeKey, Object?>, + _i7.NSObject, + Map<_i7.NSKeyValueChangeKey, Object?>, )? observeValue, }) => (super.noSuchMethod( @@ -1249,11 +1250,11 @@ class MockWebViewWidgetProxy extends _i1.Mock )? decidePolicyForNavigationAction, void Function( _i4.WKWebView, - _i6.NSError, + _i7.NSError, )? didFailNavigation, void Function( _i4.WKWebView, - _i6.NSError, + _i7.NSError, )? didFailProvisionalNavigation, void Function(_i4.WKWebView)? webViewWebContentProcessDidTerminate, }) => 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 4afe6aa647d9..e445f9963e21 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,6 +4,7 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; +import 'dart:ui' as _i6; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' @@ -255,7 +256,7 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { ), ) as _i2.WKWebView); @override - _i4.Future setBackgroundColor(dynamic color) => (super.noSuchMethod( + _i4.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], From 571bce43efd5700e53510fb2b0278326ab1ed835 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:56:13 -0400 Subject: [PATCH 12/15] docs fix --- .../webview_flutter/lib/src/webview_controller.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart index 014514d09792..fc5e380b5524 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart @@ -53,7 +53,7 @@ class WebViewController { /// Constructs a [WebViewController] from creation params for a specific /// platform. /// - /// {@template webview_flutter.WebViewCookieManager.fromPlatformCreationParams} + /// {@template webview_flutter.WebViewController.fromPlatformCreationParams} /// Below is an example of setting platform-specific creation parameters for /// iOS and Android: /// From ca496816a78d0fa42150a3118fad57d171615a26 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:01:15 -0400 Subject: [PATCH 13/15] version bumps --- packages/webview_flutter/webview_flutter/CHANGELOG.md | 1 + .../webview_flutter/example/pubspec.yaml | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md index e4fd424dfba4..6193a49719b4 100644 --- a/packages/webview_flutter/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md @@ -3,6 +3,7 @@ * Adds support to track URL changes. See `NavigationDelegate(onUrlChange)`. * Updates minimum Flutter version to 3.3. * Fixes common typos in tests and documentation. +* Fixes documentation for `WebViewController` and `WebViewCookieManager`. ## 4.0.7 diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index 61a7e7398c88..31e0d28a2b62 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -17,8 +17,8 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_android: ^3.0.0 - webview_flutter_wkwebview: ^3.0.0 + webview_flutter_android: ^3.5.0 + webview_flutter_wkwebview: ^3.3.0 dev_dependencies: build_runner: ^2.1.5 @@ -38,10 +38,3 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_android: - path: ../../../webview_flutter/webview_flutter_android - webview_flutter_wkwebview: - path: ../../../webview_flutter/webview_flutter_wkwebview From 45176156b8476b5bff7309a666cf49498b2b8340 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:05:25 -0400 Subject: [PATCH 14/15] remove overrides --- packages/webview_flutter/webview_flutter/pubspec.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index e5427f610d4f..85846a18e403 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -31,10 +31,3 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 plugin_platform_interface: ^2.1.3 - -# FOR TESTING ONLY. DO NOT MERGE. -dependency_overrides: - webview_flutter_android: - path: ../../webview_flutter/webview_flutter_android - webview_flutter_wkwebview: - path: ../../webview_flutter/webview_flutter_wkwebview From 516cec38634cafdb5f10c433c8af1dced88fb55d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:12:54 -0400 Subject: [PATCH 15/15] change template name --- .../webview_flutter/lib/src/navigation_delegate.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 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 fc06c15177f1..9f3923c160ee 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -37,7 +37,7 @@ import 'webview_controller.dart'; class NavigationDelegate { /// Constructs a [NavigationDelegate]. /// - /// {@template webview_fluttter.navigation_delegate} + /// {@template webview_fluttter.navigation_delegate.constructor} /// `onUrlChange`: invoked when the underlying web view changes to a new url. /// {@endtemplate} NavigationDelegate({ @@ -88,7 +88,7 @@ class NavigationDelegate { /// ``` /// {@endtemplate} /// - /// {@macro webview_fluttter.navigation_delegate} + /// {@macro webview_fluttter.navigation_delegate.constructor} NavigationDelegate.fromPlatformCreationParams( PlatformNavigationDelegateCreationParams params, { FutureOr Function(NavigationRequest request)? @@ -110,7 +110,7 @@ class NavigationDelegate { /// Constructs a [NavigationDelegate] from a specific platform implementation. /// - /// {@macro webview_fluttter.navigation_delegate} + /// {@macro webview_fluttter.navigation_delegate.constructor} NavigationDelegate.fromPlatform( this.platform, { this.onNavigationRequest,