From c61ac23fcc6fa9a8986dbad25507427ad2980db5 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 21 Dec 2022 16:36:19 -0500 Subject: [PATCH 1/3] [webview_flutter_wkwebview] Adds support for `WKNavigationAction.navigationType` (#6863) * add navigation type to navigation action * version bump and export * remove import * ios unit test * lint warning * formatting * add readme change to CHANGELOG * remove unused method * undo mocks change * last mocks change * mention pigeon dependency --- .../webview_flutter_wkwebview/CHANGELOG.md | 6 + .../webview_flutter_wkwebview/README.md | 18 + .../ios/RunnerTests/FWFDataConvertersTests.m | 3 + .../ios/Classes/FWFDataConverters.h | 9 + .../ios/Classes/FWFDataConverters.m | 20 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 143 +- .../ios/Classes/FWFGeneratedWebKitApis.m | 772 ++++------- .../ios/Classes/FWFUIViewHostApi.m | 2 +- .../lib/src/common/web_kit.pigeon.dart | 1218 +++++++++-------- .../lib/src/web_kit/web_kit.dart | 11 +- .../lib/src/web_kit/web_kit_api_impls.dart | 3 + .../pigeons/web_kit.dart | 37 + .../webview_flutter_wkwebview/pubspec.yaml | 4 +- .../legacy/web_kit_webview_widget_test.dart | 2 + .../test/src/common/test_web_kit.pigeon.dart | 224 +-- .../test/src/web_kit/web_kit_test.dart | 2 + .../test/webkit_navigation_delegate_test.dart | 2 + 17 files changed, 1303 insertions(+), 1173 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index f859df5c4ce6..7ae38d347711 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,9 @@ +## 3.0.1 + +* Adds support for retrieving navigation type with internal class. +* Updates README with details on contributing. +* Updates pigeon dev dependency to `4.2.13`. + ## 3.0.0 * **BREAKING CHANGE** Updates platform implementation to `2.0.0` release of diff --git a/packages/webview_flutter/webview_flutter_wkwebview/README.md b/packages/webview_flutter/webview_flutter_wkwebview/README.md index 2e3a87b7f310..79359636e742 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/README.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/README.md @@ -7,5 +7,23 @@ The Apple WKWebView implementation of [`webview_flutter`][1]. This package is [endorsed][2], which means you can simply use `webview_flutter` normally. This package will be automatically included in your app when you do. +## Contributing + +This package uses [pigeon][3] to generate the communication layer between Flutter and the host +platform (iOS). The communication interface is defined in the `pigeons/web_kit.dart` +file. After editing the communication interface regenerate the communication layer by running +`flutter pub run pigeon --input pigeons/web_kit.dart`. + +Besides [pigeon][3] this package also uses [mockito][4] to generate mock objects for testing +purposes. To generate the mock objects run the following command: +```bash +flutter pub run build_runner build --delete-conflicting-outputs +``` + +If you would like to contribute to the plugin, check out our [contribution guide][5]. + [1]: https://pub.dev/packages/webview_flutter [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin +[3]: https://pub.dev/packages/pigeon +[4]: https://pub.dev/packages/mockito +[5]: https://github.com/flutter/plugins/blob/main/CONTRIBUTING.md diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m index ca7d6f938599..63e13f9e8ecf 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m @@ -59,6 +59,8 @@ - (void)testFWFWKUserScriptFromScriptData { - (void)testFWFWKNavigationActionDataFromNavigationAction { WKNavigationAction *mockNavigationAction = OCMClassMock([WKNavigationAction class]); + OCMStub([mockNavigationAction navigationType]).andReturn(WKNavigationTypeReload); + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.flutter.dev/"]]; OCMStub([mockNavigationAction request]).andReturn(request); @@ -70,6 +72,7 @@ - (void)testFWFWKNavigationActionDataFromNavigationAction { FWFWKNavigationActionData *data = FWFWKNavigationActionDataFromNavigationAction(mockNavigationAction); XCTAssertNotNil(data); + XCTAssertEqual(data.navigationType, FWFWKNavigationTypeReload); } - (void)testFWFNSUrlRequestDataFromNSURLRequest { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h index 2863048726a9..605ed53394b2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -151,4 +151,13 @@ extern FWFNSKeyValueChangeKeyEnumData *FWFNSKeyValueChangeKeyEnumDataFromNSKeyVa */ extern FWFWKScriptMessageData *FWFWKScriptMessageDataFromWKScriptMessage(WKScriptMessage *message); +/** + * Converts a WKNavigationType to an FWFWKNavigationType. + * + * @param type The object containing information to create a FWFWKNavigationType + * + * @return A FWFWKNavigationType. + */ +extern FWFWKNavigationType FWFWKNavigationTypeFromWKNavigationType(WKNavigationType type); + NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m index 8ecc9d303000..528c9565617e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -162,7 +162,8 @@ WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData( WKNavigationAction *action) { return [FWFWKNavigationActionData makeWithRequest:FWFNSUrlRequestDataFromNSURLRequest(action.request) - targetFrame:FWFWKFrameInfoDataFromWKFrameInfo(action.targetFrame)]; + targetFrame:FWFWKFrameInfoDataFromWKFrameInfo(action.targetFrame) + navigationType:FWFWKNavigationTypeFromWKNavigationType(action.navigationType)]; } FWFNSUrlRequestData *FWFNSUrlRequestDataFromNSURLRequest(NSURLRequest *request) { @@ -218,3 +219,20 @@ WKNavigationActionPolicy FWFWKNavigationActionPolicyFromEnumData( FWFWKScriptMessageData *FWFWKScriptMessageDataFromWKScriptMessage(WKScriptMessage *message) { return [FWFWKScriptMessageData makeWithName:message.name body:message.body]; } + +FWFWKNavigationType FWFWKNavigationTypeFromWKNavigationType(WKNavigationType type) { + switch (type) { + case WKNavigationTypeLinkActivated: + return FWFWKNavigationTypeLinkActivated; + case WKNavigationTypeFormSubmitted: + return FWFWKNavigationTypeFormResubmitted; + case WKNavigationTypeBackForward: + return FWFWKNavigationTypeBackForward; + case WKNavigationTypeReload: + return FWFWKNavigationTypeReload; + case WKNavigationTypeFormResubmitted: + return FWFWKNavigationTypeFormResubmitted; + case WKNavigationTypeOther: + return FWFWKNavigationTypeOther; + } +} 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 8cbd2c7c194c..cc41f4c15040 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 (v3.1.5), do not edit directly. +// Autogenerated from Pigeon (v4.2.13), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; @@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN +/// Mirror of NSKeyValueObservingOptions. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumNewValue = 0, FWFNSKeyValueObservingOptionsEnumOldValue = 1, @@ -18,6 +22,9 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumPriorNotification = 3, }; +/// Mirror of NSKeyValueChange. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeEnum) { FWFNSKeyValueChangeEnumSetting = 0, FWFNSKeyValueChangeEnumInsertion = 1, @@ -25,6 +32,9 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeEnum) { FWFNSKeyValueChangeEnumReplacement = 3, }; +/// Mirror of NSKeyValueChangeKey. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeKeyEnum) { FWFNSKeyValueChangeKeyEnumIndexes = 0, FWFNSKeyValueChangeKeyEnumKind = 1, @@ -33,11 +43,18 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeKeyEnum) { FWFNSKeyValueChangeKeyEnumOldValue = 4, }; +/// Mirror of WKUserScriptInjectionTime. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. typedef NS_ENUM(NSUInteger, FWFWKUserScriptInjectionTimeEnum) { FWFWKUserScriptInjectionTimeEnumAtDocumentStart = 0, FWFWKUserScriptInjectionTimeEnumAtDocumentEnd = 1, }; +/// Mirror of WKAudiovisualMediaTypes. +/// +/// See +/// [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumNone = 0, FWFWKAudiovisualMediaTypeEnumAudio = 1, @@ -45,6 +62,10 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumAll = 3, }; +/// Mirror of WKWebsiteDataTypes. +/// +/// See +/// https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumCookies = 0, FWFWKWebsiteDataTypeEnumMemoryCache = 1, @@ -56,11 +77,17 @@ typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumIndexedDBDatabases = 7, }; +/// Mirror of WKNavigationActionPolicy. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. typedef NS_ENUM(NSUInteger, FWFWKNavigationActionPolicyEnum) { FWFWKNavigationActionPolicyEnumAllow = 0, FWFWKNavigationActionPolicyEnumCancel = 1, }; +/// Mirror of NSHTTPCookiePropertyKey. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { FWFNSHttpCookiePropertyKeyEnumComment = 0, FWFNSHttpCookiePropertyKeyEnumCommentUrl = 1, @@ -78,6 +105,44 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { FWFNSHttpCookiePropertyKeyEnumVersion = 13, }; +/// An object that contains information about an action that causes navigation +/// to occur. +/// +/// 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. + FWFWKNavigationTypeLinkActivated = 0, + /// A request to submit a form. + /// + /// 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. + FWFWKNavigationTypeBackForward = 2, + /// A request to reload the webpage. + /// + /// 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. + FWFWKNavigationTypeFormResubmitted = 4, + /// A navigation request that originates for some other reason. + /// + /// See + /// https://developer.apple.com/documentation/webkit/wknavigationtype/wknavigationtypeother?language=objc. + FWFWKNavigationTypeOther = 5, +}; + @class FWFNSKeyValueObservingOptionsEnumData; @class FWFNSKeyValueChangeKeyEnumData; @class FWFWKUserScriptInjectionTimeEnumData; @@ -142,6 +207,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, assign) FWFNSHttpCookiePropertyKeyEnum value; @end +/// Mirror of NSURLRequest. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlrequest?language=objc. @interface FWFNSUrlRequestData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -155,6 +223,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, strong) NSDictionary *allHttpHeaderFields; @end +/// Mirror of WKUserScript. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscript?language=objc. @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -166,15 +237,23 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, strong) NSNumber *isMainFrameOnly; @end +/// Mirror of WKNavigationAction. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationaction. @interface FWFWKNavigationActionData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame; + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType; @property(nonatomic, strong) FWFNSUrlRequestData *request; @property(nonatomic, strong) FWFWKFrameInfoData *targetFrame; +@property(nonatomic, assign) FWFWKNavigationType navigationType; @end +/// Mirror of WKFrameInfo. +/// +/// See https://developer.apple.com/documentation/webkit/wkframeinfo?language=objc. @interface FWFWKFrameInfoData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -182,6 +261,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, strong) NSNumber *isMainFrame; @end +/// Mirror of NSError. +/// +/// See https://developer.apple.com/documentation/foundation/nserror?language=objc. @interface FWFNSErrorData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -193,6 +275,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, copy) NSString *localizedDescription; @end +/// Mirror of WKScriptMessage. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessage?language=objc. @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -201,6 +286,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, strong) id body; @end +/// Mirror of NSHttpCookieData. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookie?language=objc. @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; @@ -213,6 +301,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); +/// Mirror of WKWebsiteDataStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @protocol FWFWKWebsiteDataStoreHostApi - (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier @@ -233,6 +324,9 @@ extern void FWFWKWebsiteDataStoreHostApiSetup( /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); +/// Mirror of UIView. +/// +/// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @protocol FWFUIViewHostApi - (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier toValue:(nullable NSNumber *)value @@ -248,6 +342,9 @@ extern void FWFUIViewHostApiSetup(id binaryMessenger, /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); +/// Mirror of UIScrollView. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @protocol FWFUIScrollViewHostApi - (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier @@ -272,6 +369,9 @@ extern void FWFUIScrollViewHostApiSetup(id binaryMesseng /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); +/// Mirror of WKWebViewConfiguration. +/// +/// 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 @@ -300,6 +400,9 @@ extern void FWFWKWebViewConfigurationHostApiSetup( /// The codec used by FWFWKWebViewConfigurationFlutterApi. NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void); +/// Handles callbacks from an WKWebViewConfiguration instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)createWithIdentifier:(NSNumber *)identifier @@ -308,6 +411,9 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); +/// Mirror of WKUserContentController. +/// +/// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @protocol FWFWKUserContentControllerHostApi - (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier @@ -338,6 +444,9 @@ extern void FWFWKUserContentControllerHostApiSetup( /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); +/// Mirror of WKUserPreferences. +/// +/// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @protocol FWFWKPreferencesHostApi - (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier @@ -353,6 +462,9 @@ extern void FWFWKPreferencesHostApiSetup(id binaryMessen /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); +/// Mirror of WKScriptMessageHandler. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @protocol FWFWKScriptMessageHandlerHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end @@ -364,6 +476,9 @@ extern void FWFWKScriptMessageHandlerHostApiSetup( /// The codec used by FWFWKScriptMessageHandlerFlutterApi. NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void); +/// Handles callbacks from an WKScriptMessageHandler instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier @@ -374,6 +489,9 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); +/// Mirror of WKNavigationDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end @@ -385,6 +503,9 @@ extern void FWFWKNavigationDelegateHostApiSetup( /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); +/// Handles callbacks from an WKNavigationDelegate instance. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier @@ -422,6 +543,9 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); +/// Mirror of NSObject. +/// +/// See https://developer.apple.com/documentation/objectivec/nsobject. @protocol FWFNSObjectHostApi - (void)disposeObjectWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @@ -443,6 +567,9 @@ extern void FWFNSObjectHostApiSetup(id binaryMessenger, /// The codec used by FWFNSObjectFlutterApi. NSObject *FWFNSObjectFlutterApiGetCodec(void); +/// Handles callbacks from an NSObject instance. +/// +/// See https://developer.apple.com/documentation/objectivec/nsobject. @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier @@ -457,6 +584,9 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void); /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); +/// Mirror of WKWebView. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. @protocol FWFWKWebViewHostApi - (void)createWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier @@ -521,6 +651,9 @@ extern void FWFWKWebViewHostApiSetup(id binaryMessenger, /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); +/// Mirror of WKUIDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @protocol FWFWKUIDelegateHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end @@ -531,6 +664,9 @@ extern void FWFWKUIDelegateHostApiSetup(id binaryMesseng /// The codec used by FWFWKUIDelegateFlutterApi. NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); +/// Handles callbacks from an WKUIDelegate instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier @@ -542,6 +678,9 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); +/// Mirror of WKHttpCookieStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. @protocol FWFWKHttpCookieStoreHostApi - (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier 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 10680227ee43..b2a365b038c3 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 (v3.1.5), do not edit directly. +// Autogenerated from Pigeon (v4.2.13), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "FWFGeneratedWebKitApis.h" #import @@ -10,23 +10,13 @@ #error File requires ARC to be enabled. #endif -static NSDictionary *wrapResult(id result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; +static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - errorDict = @{ - @"code" : (error.code ?: [NSNull null]), - @"message" : (error.message ?: [NSNull null]), - @"details" : (error.details ?: [NSNull null]), - }; - } - return @{ - @"result" : (result ?: [NSNull null]), - @"error" : errorDict, - }; -} -static id GetNullableObject(NSDictionary *dict, id key) { - id result = dict[key]; - return (result == [NSNull null]) ? nil : result; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; + } + return @[ result ?: [NSNull null] ]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; @@ -34,74 +24,74 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } @interface FWFNSKeyValueObservingOptionsEnumData () -+ (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list; ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFNSKeyValueChangeKeyEnumData () -+ (FWFNSKeyValueChangeKeyEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSKeyValueChangeKeyEnumData *)fromList:(NSArray *)list; ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKUserScriptInjectionTimeEnumData () -+ (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKUserScriptInjectionTimeEnumData *)fromList:(NSArray *)list; ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKAudiovisualMediaTypeEnumData () -+ (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKAudiovisualMediaTypeEnumData *)fromList:(NSArray *)list; ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKWebsiteDataTypeEnumData () -+ (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKWebsiteDataTypeEnumData *)fromList:(NSArray *)list; ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKNavigationActionPolicyEnumData () -+ (FWFWKNavigationActionPolicyEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKNavigationActionPolicyEnumData *)fromList:(NSArray *)list; ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFNSHttpCookiePropertyKeyEnumData () -+ (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSHttpCookiePropertyKeyEnumData *)fromList:(NSArray *)list; ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFNSUrlRequestData () -+ (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSUrlRequestData *)fromList:(NSArray *)list; ++ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKUserScriptData () -+ (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKUserScriptData *)fromList:(NSArray *)list; ++ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKNavigationActionData () -+ (FWFWKNavigationActionData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKNavigationActionData *)fromList:(NSArray *)list; ++ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKFrameInfoData () -+ (FWFWKFrameInfoData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKFrameInfoData *)fromList:(NSArray *)list; ++ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFNSErrorData () -+ (FWFNSErrorData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSErrorData *)fromList:(NSArray *)list; ++ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFWKScriptMessageData () -+ (FWFWKScriptMessageData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFWKScriptMessageData *)fromList:(NSArray *)list; ++ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FWFNSHttpCookieData () -+ (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict; -+ (nullable FWFNSHttpCookieData *)nullableFromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FWFNSHttpCookieData *)fromList:(NSArray *)list; ++ (nullable FWFNSHttpCookieData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @implementation FWFNSKeyValueObservingOptionsEnumData @@ -111,19 +101,19 @@ + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFNSKeyValueObservingOptionsEnumData *)fromList:(NSArray *)list { FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFNSKeyValueObservingOptionsEnumData fromMap:dict] : nil; ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSKeyValueObservingOptionsEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -133,18 +123,18 @@ + (instancetype)makeWithValue:(FWFNSKeyValueChangeKeyEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFNSKeyValueChangeKeyEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFNSKeyValueChangeKeyEnumData *)fromList:(NSArray *)list { FWFNSKeyValueChangeKeyEnumData *pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFNSKeyValueChangeKeyEnumData fromMap:dict] : nil; ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSKeyValueChangeKeyEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -155,19 +145,19 @@ + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFWKUserScriptInjectionTimeEnumData *)fromList:(NSArray *)list { FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKUserScriptInjectionTimeEnumData fromMap:dict] : nil; ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKUserScriptInjectionTimeEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -178,19 +168,19 @@ + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFWKAudiovisualMediaTypeEnumData *)fromList:(NSArray *)list { FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKAudiovisualMediaTypeEnumData fromMap:dict] : nil; ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKAudiovisualMediaTypeEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -200,18 +190,18 @@ + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFWKWebsiteDataTypeEnumData *)fromList:(NSArray *)list { FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKWebsiteDataTypeEnumData fromMap:dict] : nil; ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKWebsiteDataTypeEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -222,19 +212,19 @@ + (instancetype)makeWithValue:(FWFWKNavigationActionPolicyEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFWKNavigationActionPolicyEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFWKNavigationActionPolicyEnumData *)fromList:(NSArray *)list { FWFWKNavigationActionPolicyEnumData *pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKNavigationActionPolicyEnumData fromMap:dict] : nil; ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKNavigationActionPolicyEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -245,19 +235,19 @@ + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { pigeonResult.value = value; return pigeonResult; } -+ (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { ++ (FWFNSHttpCookiePropertyKeyEnumData *)fromList:(NSArray *)list { FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; - pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; + pigeonResult.value = [GetNullableObjectAtIndex(list, 0) integerValue]; return pigeonResult; } -+ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFNSHttpCookiePropertyKeyEnumData fromMap:dict] : nil; ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSHttpCookiePropertyKeyEnumData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"value" : @(self.value), - }; +- (NSArray *)toList { + return @[ + @(self.value), + ]; } @end @@ -273,26 +263,26 @@ + (instancetype)makeWithUrl:(NSString *)url pigeonResult.allHttpHeaderFields = allHttpHeaderFields; return pigeonResult; } -+ (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { ++ (FWFNSUrlRequestData *)fromList:(NSArray *)list { FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; - pigeonResult.url = GetNullableObject(dict, @"url"); + pigeonResult.url = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.url != nil, @""); - pigeonResult.httpMethod = GetNullableObject(dict, @"httpMethod"); - pigeonResult.httpBody = GetNullableObject(dict, @"httpBody"); - pigeonResult.allHttpHeaderFields = GetNullableObject(dict, @"allHttpHeaderFields"); + pigeonResult.httpMethod = GetNullableObjectAtIndex(list, 1); + pigeonResult.httpBody = GetNullableObjectAtIndex(list, 2); + pigeonResult.allHttpHeaderFields = GetNullableObjectAtIndex(list, 3); NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } -+ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFNSUrlRequestData fromMap:dict] : nil; ++ (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSUrlRequestData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"url" : (self.url ?: [NSNull null]), - @"httpMethod" : (self.httpMethod ?: [NSNull null]), - @"httpBody" : (self.httpBody ?: [NSNull null]), - @"allHttpHeaderFields" : (self.allHttpHeaderFields ?: [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.url ?: [NSNull null]), + (self.httpMethod ?: [NSNull null]), + (self.httpBody ?: [NSNull null]), + (self.allHttpHeaderFields ?: [NSNull null]), + ]; } @end @@ -306,53 +296,57 @@ + (instancetype)makeWithSource:(NSString *)source pigeonResult.isMainFrameOnly = isMainFrameOnly; return pigeonResult; } -+ (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { ++ (FWFWKUserScriptData *)fromList:(NSArray *)list { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; - pigeonResult.source = GetNullableObject(dict, @"source"); + pigeonResult.source = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData - nullableFromMap:GetNullableObject(dict, @"injectionTime")]; - pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); + pigeonResult.injectionTime = + [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; + pigeonResult.isMainFrameOnly = GetNullableObjectAtIndex(list, 2); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } -+ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKUserScriptData fromMap:dict] : nil; ++ (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKUserScriptData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"source" : (self.source ?: [NSNull null]), - @"injectionTime" : (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), - @"isMainFrameOnly" : (self.isMainFrameOnly ?: [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.source ?: [NSNull null]), + (self.injectionTime ? [self.injectionTime toList] : [NSNull null]), + (self.isMainFrameOnly ?: [NSNull null]), + ]; } @end @implementation FWFWKNavigationActionData + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame { + targetFrame:(FWFWKFrameInfoData *)targetFrame + navigationType:(FWFWKNavigationType)navigationType { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = request; pigeonResult.targetFrame = targetFrame; + pigeonResult.navigationType = navigationType; return pigeonResult; } -+ (FWFWKNavigationActionData *)fromMap:(NSDictionary *)dict { ++ (FWFWKNavigationActionData *)fromList:(NSArray *)list { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; - pigeonResult.request = [FWFNSUrlRequestData nullableFromMap:GetNullableObject(dict, @"request")]; + pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 0))]; NSAssert(pigeonResult.request != nil, @""); pigeonResult.targetFrame = - [FWFWKFrameInfoData nullableFromMap:GetNullableObject(dict, @"targetFrame")]; + [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; NSAssert(pigeonResult.targetFrame != nil, @""); + pigeonResult.navigationType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKNavigationActionData fromMap:dict] : nil; ++ (nullable FWFWKNavigationActionData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKNavigationActionData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"request" : (self.request ? [self.request toMap] : [NSNull null]), - @"targetFrame" : (self.targetFrame ? [self.targetFrame toMap] : [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.request ? [self.request toList] : [NSNull null]), + (self.targetFrame ? [self.targetFrame toList] : [NSNull null]), + @(self.navigationType), + ]; } @end @@ -362,19 +356,19 @@ + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } -+ (FWFWKFrameInfoData *)fromMap:(NSDictionary *)dict { ++ (FWFWKFrameInfoData *)fromList:(NSArray *)list { FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; - pigeonResult.isMainFrame = GetNullableObject(dict, @"isMainFrame"); + pigeonResult.isMainFrame = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.isMainFrame != nil, @""); return pigeonResult; } -+ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKFrameInfoData fromMap:dict] : nil; ++ (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKFrameInfoData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"isMainFrame" : (self.isMainFrame ?: [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.isMainFrame ?: [NSNull null]), + ]; } @end @@ -388,25 +382,25 @@ + (instancetype)makeWithCode:(NSNumber *)code pigeonResult.localizedDescription = localizedDescription; return pigeonResult; } -+ (FWFNSErrorData *)fromMap:(NSDictionary *)dict { ++ (FWFNSErrorData *)fromList:(NSArray *)list { FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; - pigeonResult.code = GetNullableObject(dict, @"code"); + pigeonResult.code = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.code != nil, @""); - pigeonResult.domain = GetNullableObject(dict, @"domain"); + pigeonResult.domain = GetNullableObjectAtIndex(list, 1); NSAssert(pigeonResult.domain != nil, @""); - pigeonResult.localizedDescription = GetNullableObject(dict, @"localizedDescription"); + pigeonResult.localizedDescription = GetNullableObjectAtIndex(list, 2); NSAssert(pigeonResult.localizedDescription != nil, @""); return pigeonResult; } -+ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFNSErrorData fromMap:dict] : nil; ++ (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFNSErrorData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"code" : (self.code ?: [NSNull null]), - @"domain" : (self.domain ?: [NSNull null]), - @"localizedDescription" : (self.localizedDescription ?: [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.code ?: [NSNull null]), + (self.domain ?: [NSNull null]), + (self.localizedDescription ?: [NSNull null]), + ]; } @end @@ -417,21 +411,21 @@ + (instancetype)makeWithName:(NSString *)name body:(id)body { pigeonResult.body = body; return pigeonResult; } -+ (FWFWKScriptMessageData *)fromMap:(NSDictionary *)dict { ++ (FWFWKScriptMessageData *)fromList:(NSArray *)list { FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; - pigeonResult.name = GetNullableObject(dict, @"name"); + pigeonResult.name = GetNullableObjectAtIndex(list, 0); NSAssert(pigeonResult.name != nil, @""); - pigeonResult.body = GetNullableObject(dict, @"body"); + pigeonResult.body = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -+ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict { - return (dict) ? [FWFWKScriptMessageData fromMap:dict] : nil; ++ (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { + return (list) ? [FWFWKScriptMessageData fromList:list] : nil; } -- (NSDictionary *)toMap { - return @{ - @"name" : (self.name ?: [NSNull null]), - @"body" : (self.body ?: [NSNull null]), - }; +- (NSArray *)toList { + return @[ + (self.name ?: [NSNull null]), + (self.body ?: [NSNull null]), + ]; } @end @@ -443,22 +437,22 @@ + (instancetype)makeWithPropertyKeys:(NSArray *FWFWKWebsiteDataStoreHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; @@ -591,35 +585,9 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge } } } -@interface FWFUIViewHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFUIViewHostApiCodecReader -@end - -@interface FWFUIViewHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFUIViewHostApiCodecWriter -@end - -@interface FWFUIViewHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFUIViewHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFUIViewHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFUIViewHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFUIViewHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIViewHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -671,35 +639,9 @@ void FWFUIViewHostApiSetup(id binaryMessenger, } } } -@interface FWFUIScrollViewHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFUIScrollViewHostApiCodecReader -@end - -@interface FWFUIScrollViewHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFUIScrollViewHostApiCodecWriter -@end - -@interface FWFUIScrollViewHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFUIScrollViewHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFUIScrollViewHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFUIScrollViewHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFUIScrollViewHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -809,7 +751,7 @@ @implementation FWFWKWebViewConfigurationHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; + return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -823,7 +765,7 @@ @implementation FWFWKWebViewConfigurationHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -842,8 +784,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKWebViewConfigurationHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; @@ -956,35 +898,9 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess } } } -@interface FWFWKWebViewConfigurationFlutterApiCodecReader : FlutterStandardReader -@end -@implementation FWFWKWebViewConfigurationFlutterApiCodecReader -@end - -@interface FWFWKWebViewConfigurationFlutterApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFWKWebViewConfigurationFlutterApiCodecWriter -@end - -@interface FWFWKWebViewConfigurationFlutterApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFWKWebViewConfigurationFlutterApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFWKWebViewConfigurationFlutterApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFWKWebViewConfigurationFlutterApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewConfigurationFlutterApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -1019,10 +935,10 @@ @implementation FWFWKUserContentControllerHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFWKUserScriptData fromMap:[self readValue]]; + return [FWFWKUserScriptData fromList:[self readValue]]; case 129: - return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; + return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1036,10 +952,10 @@ @implementation FWFWKUserContentControllerHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1058,8 +974,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKUserContentControllerHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; @@ -1223,35 +1139,9 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes } } } -@interface FWFWKPreferencesHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFWKPreferencesHostApiCodecReader -@end - -@interface FWFWKPreferencesHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFWKPreferencesHostApiCodecWriter -@end - -@interface FWFWKPreferencesHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFWKPreferencesHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFWKPreferencesHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFWKPreferencesHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFWKPreferencesHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = - [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -1309,35 +1199,9 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, } } } -@interface FWFWKScriptMessageHandlerHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFWKScriptMessageHandlerHostApiCodecReader -@end - -@interface FWFWKScriptMessageHandlerHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFWKScriptMessageHandlerHostApiCodecWriter -@end - -@interface FWFWKScriptMessageHandlerHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFWKScriptMessageHandlerHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFWKScriptMessageHandlerHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFWKScriptMessageHandlerHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFWKScriptMessageHandlerHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -1371,7 +1235,7 @@ @implementation FWFWKScriptMessageHandlerFlutterApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFWKScriptMessageData fromMap:[self readValue]]; + return [FWFWKScriptMessageData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1385,7 +1249,7 @@ @implementation FWFWKScriptMessageHandlerFlutterApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1404,8 +1268,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; @@ -1446,35 +1310,9 @@ - (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifi }]; } @end -@interface FWFWKNavigationDelegateHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFWKNavigationDelegateHostApiCodecReader -@end - -@interface FWFWKNavigationDelegateHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFWKNavigationDelegateHostApiCodecWriter -@end - -@interface FWFWKNavigationDelegateHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFWKNavigationDelegateHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFWKNavigationDelegateHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFWKNavigationDelegateHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFWKNavigationDelegateHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -1508,19 +1346,19 @@ @implementation FWFWKNavigationDelegateFlutterApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSErrorData fromMap:[self readValue]]; + return [FWFNSErrorData fromList:[self readValue]]; case 129: - return [FWFNSUrlRequestData fromMap:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 130: - return [FWFWKFrameInfoData fromMap:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 131: - return [FWFWKNavigationActionData fromMap:[self readValue]]; + return [FWFWKNavigationActionData fromList:[self readValue]]; case 132: - return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; + return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1534,19 +1372,19 @@ @implementation FWFWKNavigationDelegateFlutterApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:130]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:131]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:132]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1565,8 +1403,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKNavigationDelegateFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; @@ -1702,7 +1540,7 @@ @implementation FWFNSObjectHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; + return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1716,7 +1554,7 @@ @implementation FWFNSObjectHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1735,8 +1573,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFNSObjectHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; @@ -1835,46 +1673,46 @@ @implementation FWFNSObjectFlutterApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSErrorData fromMap:[self readValue]]; + return [FWFNSErrorData fromList:[self readValue]]; case 129: - return [FWFNSHttpCookieData fromMap:[self readValue]]; + return [FWFNSHttpCookieData fromList:[self readValue]]; case 130: - return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; + return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; case 131: - return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; + return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; case 132: - return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; + return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; case 133: - return [FWFNSUrlRequestData fromMap:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 134: - return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; + return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; case 135: - return [FWFWKFrameInfoData fromMap:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 136: - return [FWFWKNavigationActionData fromMap:[self readValue]]; + return [FWFWKNavigationActionData fromList:[self readValue]]; case 137: - return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; + return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; case 138: - return [FWFWKScriptMessageData fromMap:[self readValue]]; + return [FWFWKScriptMessageData fromList:[self readValue]]; case 139: - return [FWFWKUserScriptData fromMap:[self readValue]]; + return [FWFWKUserScriptData fromList:[self readValue]]; case 140: - return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; + return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; case 141: - return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; + return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1888,46 +1726,46 @@ @implementation FWFNSObjectFlutterApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -1946,8 +1784,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFNSObjectFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; @@ -2007,46 +1845,46 @@ @implementation FWFWKWebViewHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSErrorData fromMap:[self readValue]]; + return [FWFNSErrorData fromList:[self readValue]]; case 129: - return [FWFNSHttpCookieData fromMap:[self readValue]]; + return [FWFNSHttpCookieData fromList:[self readValue]]; case 130: - return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; + return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; case 131: - return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; + return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]]; case 132: - return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; + return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]]; case 133: - return [FWFNSUrlRequestData fromMap:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 134: - return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; + return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]]; case 135: - return [FWFWKFrameInfoData fromMap:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 136: - return [FWFWKNavigationActionData fromMap:[self readValue]]; + return [FWFWKNavigationActionData fromList:[self readValue]]; case 137: - return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; + return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]]; case 138: - return [FWFWKScriptMessageData fromMap:[self readValue]]; + return [FWFWKScriptMessageData fromList:[self readValue]]; case 139: - return [FWFWKUserScriptData fromMap:[self readValue]]; + return [FWFWKUserScriptData fromList:[self readValue]]; case 140: - return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; + return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]]; case 141: - return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; + return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -2060,46 +1898,46 @@ @implementation FWFWKWebViewHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -2118,8 +1956,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKWebViewHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; @@ -2555,35 +2393,9 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, } } } -@interface FWFWKUIDelegateHostApiCodecReader : FlutterStandardReader -@end -@implementation FWFWKUIDelegateHostApiCodecReader -@end - -@interface FWFWKUIDelegateHostApiCodecWriter : FlutterStandardWriter -@end -@implementation FWFWKUIDelegateHostApiCodecWriter -@end - -@interface FWFWKUIDelegateHostApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FWFWKUIDelegateHostApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FWFWKUIDelegateHostApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FWFWKUIDelegateHostApiCodecReader alloc] initWithData:data]; -} -@end - NSObject *FWFWKUIDelegateHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; - dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); + sSharedObject = [FlutterStandardMessageCodec sharedInstance]; return sSharedObject; } @@ -2617,13 +2429,13 @@ @implementation FWFWKUIDelegateFlutterApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSUrlRequestData fromMap:[self readValue]]; + return [FWFNSUrlRequestData fromList:[self readValue]]; case 129: - return [FWFWKFrameInfoData fromMap:[self readValue]]; + return [FWFWKFrameInfoData fromList:[self readValue]]; case 130: - return [FWFWKNavigationActionData fromMap:[self readValue]]; + return [FWFWKNavigationActionData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -2637,13 +2449,13 @@ @implementation FWFWKUIDelegateFlutterApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:130]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -2662,8 +2474,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKUIDelegateFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; @@ -2709,10 +2521,10 @@ @implementation FWFWKHttpCookieStoreHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FWFNSHttpCookieData fromMap:[self readValue]]; + return [FWFNSHttpCookieData fromList:[self readValue]]; case 129: - return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; + return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -2726,10 +2538,10 @@ @implementation FWFWKHttpCookieStoreHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -2748,8 +2560,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FWFWKHttpCookieStoreHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m index a990561c4fba..1e168d0a8fcb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -25,7 +25,7 @@ - (UIView *)viewForIdentifier:(NSNumber *)identifier { - (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)identifier toValue:(nullable NSNumber *)color error:(FlutterError *_Nullable *_Nonnull)error { - if (!color) { + if (color == nil) { [[self viewForIdentifier:identifier] setBackgroundColor:nil]; } int colorInt = color.intValue; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart index 54bb3015af64..26f215e2684c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart @@ -1,16 +1,18 @@ // Copyright 2013 The Flutter 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 (v3.1.5), do not edit directly. +// Autogenerated from Pigeon (v4.2.13), 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 -// @dart = 2.12 +// 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'; -import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +/// Mirror of NSKeyValueObservingOptions. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. enum NSKeyValueObservingOptionsEnum { newValue, oldValue, @@ -18,6 +20,9 @@ enum NSKeyValueObservingOptionsEnum { priorNotification, } +/// Mirror of NSKeyValueChange. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. enum NSKeyValueChangeEnum { setting, insertion, @@ -25,6 +30,9 @@ enum NSKeyValueChangeEnum { replacement, } +/// Mirror of NSKeyValueChangeKey. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. enum NSKeyValueChangeKeyEnum { indexes, kind, @@ -33,11 +41,17 @@ enum NSKeyValueChangeKeyEnum { oldValue, } +/// Mirror of WKUserScriptInjectionTime. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. enum WKUserScriptInjectionTimeEnum { atDocumentStart, atDocumentEnd, } +/// Mirror of WKAudiovisualMediaTypes. +/// +/// See [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). enum WKAudiovisualMediaTypeEnum { none, audio, @@ -45,6 +59,9 @@ enum WKAudiovisualMediaTypeEnum { all, } +/// Mirror of WKWebsiteDataTypes. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. enum WKWebsiteDataTypeEnum { cookies, memoryCache, @@ -56,11 +73,17 @@ enum WKWebsiteDataTypeEnum { indexedDBDatabases, } +/// Mirror of WKNavigationActionPolicy. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. enum WKNavigationActionPolicyEnum { allow, cancel, } +/// Mirror of NSHTTPCookiePropertyKey. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. enum NSHttpCookiePropertyKeyEnum { comment, commentUrl, @@ -78,6 +101,42 @@ enum NSHttpCookiePropertyKeyEnum { version, } +/// An object that contains information about an action that causes navigation +/// to occur. +/// +/// Wraps [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +enum WKNavigationType { + /// A link activation. + /// + /// 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. + other, +} + class NSKeyValueObservingOptionsEnumData { NSKeyValueObservingOptionsEnumData({ required this.value, @@ -86,15 +145,15 @@ class NSKeyValueObservingOptionsEnumData { NSKeyValueObservingOptionsEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static NSKeyValueObservingOptionsEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static NSKeyValueObservingOptionsEnumData decode(Object result) { + result as List; return NSKeyValueObservingOptionsEnumData( - value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int], + value: NSKeyValueObservingOptionsEnum.values[result[0]! as int], ); } } @@ -107,15 +166,15 @@ class NSKeyValueChangeKeyEnumData { NSKeyValueChangeKeyEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static NSKeyValueChangeKeyEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static NSKeyValueChangeKeyEnumData decode(Object result) { + result as List; return NSKeyValueChangeKeyEnumData( - value: NSKeyValueChangeKeyEnum.values[pigeonMap['value']! as int], + value: NSKeyValueChangeKeyEnum.values[result[0]! as int], ); } } @@ -128,15 +187,15 @@ class WKUserScriptInjectionTimeEnumData { WKUserScriptInjectionTimeEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static WKUserScriptInjectionTimeEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static WKUserScriptInjectionTimeEnumData decode(Object result) { + result as List; return WKUserScriptInjectionTimeEnumData( - value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int], + value: WKUserScriptInjectionTimeEnum.values[result[0]! as int], ); } } @@ -149,15 +208,15 @@ class WKAudiovisualMediaTypeEnumData { WKAudiovisualMediaTypeEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static WKAudiovisualMediaTypeEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static WKAudiovisualMediaTypeEnumData decode(Object result) { + result as List; return WKAudiovisualMediaTypeEnumData( - value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int], + value: WKAudiovisualMediaTypeEnum.values[result[0]! as int], ); } } @@ -170,15 +229,15 @@ class WKWebsiteDataTypeEnumData { WKWebsiteDataTypeEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static WKWebsiteDataTypeEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static WKWebsiteDataTypeEnumData decode(Object result) { + result as List; return WKWebsiteDataTypeEnumData( - value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int], + value: WKWebsiteDataTypeEnum.values[result[0]! as int], ); } } @@ -191,15 +250,15 @@ class WKNavigationActionPolicyEnumData { WKNavigationActionPolicyEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static WKNavigationActionPolicyEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static WKNavigationActionPolicyEnumData decode(Object result) { + result as List; return WKNavigationActionPolicyEnumData( - value: WKNavigationActionPolicyEnum.values[pigeonMap['value']! as int], + value: WKNavigationActionPolicyEnum.values[result[0]! as int], ); } } @@ -212,19 +271,22 @@ class NSHttpCookiePropertyKeyEnumData { NSHttpCookiePropertyKeyEnum value; Object encode() { - final Map pigeonMap = {}; - pigeonMap['value'] = value.index; - return pigeonMap; + return [ + value.index, + ]; } - static NSHttpCookiePropertyKeyEnumData decode(Object message) { - final Map pigeonMap = message as Map; + static NSHttpCookiePropertyKeyEnumData decode(Object result) { + result as List; return NSHttpCookiePropertyKeyEnumData( - value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int], + value: NSHttpCookiePropertyKeyEnum.values[result[0]! as int], ); } } +/// Mirror of NSURLRequest. +/// +/// See https://developer.apple.com/documentation/foundation/nsurlrequest?language=objc. class NSUrlRequestData { NSUrlRequestData({ required this.url, @@ -234,32 +296,37 @@ class NSUrlRequestData { }); String url; + String? httpMethod; + Uint8List? httpBody; + Map allHttpHeaderFields; Object encode() { - final Map pigeonMap = {}; - pigeonMap['url'] = url; - pigeonMap['httpMethod'] = httpMethod; - pigeonMap['httpBody'] = httpBody; - pigeonMap['allHttpHeaderFields'] = allHttpHeaderFields; - return pigeonMap; + return [ + url, + httpMethod, + httpBody, + allHttpHeaderFields, + ]; } - static NSUrlRequestData decode(Object message) { - final Map pigeonMap = message as Map; + static NSUrlRequestData decode(Object result) { + result as List; return NSUrlRequestData( - url: pigeonMap['url']! as String, - httpMethod: pigeonMap['httpMethod'] as String?, - httpBody: pigeonMap['httpBody'] as Uint8List?, + url: result[0]! as String, + httpMethod: result[1] as String?, + httpBody: result[2] as Uint8List?, allHttpHeaderFields: - (pigeonMap['allHttpHeaderFields'] as Map?)! - .cast(), + (result[3] as Map?)!.cast(), ); } } +/// Mirror of WKUserScript. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscript?language=objc. class WKUserScriptData { WKUserScriptData({ required this.source, @@ -268,55 +335,69 @@ class WKUserScriptData { }); String source; + WKUserScriptInjectionTimeEnumData? injectionTime; + bool isMainFrameOnly; Object encode() { - final Map pigeonMap = {}; - pigeonMap['source'] = source; - pigeonMap['injectionTime'] = injectionTime?.encode(); - pigeonMap['isMainFrameOnly'] = isMainFrameOnly; - return pigeonMap; + return [ + source, + injectionTime?.encode(), + isMainFrameOnly, + ]; } - static WKUserScriptData decode(Object message) { - final Map pigeonMap = message as Map; + static WKUserScriptData decode(Object result) { + result as List; return WKUserScriptData( - source: pigeonMap['source']! as String, - injectionTime: pigeonMap['injectionTime'] != null + source: result[0]! as String, + injectionTime: result[1] != null ? WKUserScriptInjectionTimeEnumData.decode( - pigeonMap['injectionTime']!) + result[1]! as List) : null, - isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, + isMainFrameOnly: result[2]! as bool, ); } } +/// Mirror of WKNavigationAction. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationaction. class WKNavigationActionData { WKNavigationActionData({ required this.request, required this.targetFrame, + required this.navigationType, }); NSUrlRequestData request; + WKFrameInfoData targetFrame; + WKNavigationType navigationType; + Object encode() { - final Map pigeonMap = {}; - pigeonMap['request'] = request.encode(); - pigeonMap['targetFrame'] = targetFrame.encode(); - return pigeonMap; + return [ + request.encode(), + targetFrame.encode(), + navigationType.index, + ]; } - static WKNavigationActionData decode(Object message) { - final Map pigeonMap = message as Map; + static WKNavigationActionData decode(Object result) { + result as List; return WKNavigationActionData( - request: NSUrlRequestData.decode(pigeonMap['request']!), - targetFrame: WKFrameInfoData.decode(pigeonMap['targetFrame']!), + request: NSUrlRequestData.decode(result[0]! as List), + targetFrame: WKFrameInfoData.decode(result[1]! as List), + navigationType: WKNavigationType.values[result[2]! as int], ); } } +/// Mirror of WKFrameInfo. +/// +/// See https://developer.apple.com/documentation/webkit/wkframeinfo?language=objc. class WKFrameInfoData { WKFrameInfoData({ required this.isMainFrame, @@ -325,19 +406,22 @@ class WKFrameInfoData { bool isMainFrame; Object encode() { - final Map pigeonMap = {}; - pigeonMap['isMainFrame'] = isMainFrame; - return pigeonMap; + return [ + isMainFrame, + ]; } - static WKFrameInfoData decode(Object message) { - final Map pigeonMap = message as Map; + static WKFrameInfoData decode(Object result) { + result as List; return WKFrameInfoData( - isMainFrame: pigeonMap['isMainFrame']! as bool, + isMainFrame: result[0]! as bool, ); } } +/// Mirror of NSError. +/// +/// See https://developer.apple.com/documentation/foundation/nserror?language=objc. class NSErrorData { NSErrorData({ required this.code, @@ -346,27 +430,32 @@ class NSErrorData { }); int code; + String domain; + String localizedDescription; Object encode() { - final Map pigeonMap = {}; - pigeonMap['code'] = code; - pigeonMap['domain'] = domain; - pigeonMap['localizedDescription'] = localizedDescription; - return pigeonMap; + return [ + code, + domain, + localizedDescription, + ]; } - static NSErrorData decode(Object message) { - final Map pigeonMap = message as Map; + static NSErrorData decode(Object result) { + result as List; return NSErrorData( - code: pigeonMap['code']! as int, - domain: pigeonMap['domain']! as String, - localizedDescription: pigeonMap['localizedDescription']! as String, + code: result[0]! as int, + domain: result[1]! as String, + localizedDescription: result[2]! as String, ); } } +/// Mirror of WKScriptMessage. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessage?language=objc. class WKScriptMessageData { WKScriptMessageData({ required this.name, @@ -374,24 +463,28 @@ class WKScriptMessageData { }); String name; + Object? body; Object encode() { - final Map pigeonMap = {}; - pigeonMap['name'] = name; - pigeonMap['body'] = body; - return pigeonMap; + return [ + name, + body, + ]; } - static WKScriptMessageData decode(Object message) { - final Map pigeonMap = message as Map; + static WKScriptMessageData decode(Object result) { + result as List; return WKScriptMessageData( - name: pigeonMap['name']! as String, - body: pigeonMap['body'] as Object?, + name: result[0]! as String, + body: result[1] as Object?, ); } } +/// Mirror of NSHttpCookieData. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookie?language=objc. class NSHttpCookieData { NSHttpCookieData({ required this.propertyKeys, @@ -399,22 +492,22 @@ class NSHttpCookieData { }); List propertyKeys; + List propertyValues; Object encode() { - final Map pigeonMap = {}; - pigeonMap['propertyKeys'] = propertyKeys; - pigeonMap['propertyValues'] = propertyValues; - return pigeonMap; + return [ + propertyKeys, + propertyValues, + ]; } - static NSHttpCookieData decode(Object message) { - final Map pigeonMap = message as Map; + static NSHttpCookieData decode(Object result) { + result as List; return NSHttpCookieData( - propertyKeys: (pigeonMap['propertyKeys'] as List?)! + propertyKeys: (result[0] as List?)! .cast(), - propertyValues: - (pigeonMap['propertyValues'] as List?)!.cast(), + propertyValues: (result[1] as List?)!.cast(), ); } } @@ -443,13 +536,15 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebsiteDataStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. class WKWebsiteDataStoreHostApi { /// Constructor for [WKWebsiteDataStoreHostApi]. 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. WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); @@ -460,21 +555,19 @@ class WKWebsiteDataStoreHostApi { 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -486,20 +579,18 @@ class WKWebsiteDataStoreHostApi { 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -513,68 +604,62 @@ class WKWebsiteDataStoreHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ + final List? replyList = await channel.send([ arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch - ]) as Map?; - if (replyMap == null) { + ]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as bool?)!; + return (replyList[0] as bool?)!; } } } -class _UIViewHostApiCodec extends StandardMessageCodec { - const _UIViewHostApiCodec(); -} - +/// Mirror of UIView. +/// +/// See https://developer.apple.com/documentation/uikit/uiview?language=objc. class UIViewHostApi { /// Constructor for [UIViewHostApi]. 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. UIViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _UIViewHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future setBackgroundColor(int arg_identifier, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_value]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_value]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -585,20 +670,18 @@ class UIViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_opaque]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_opaque]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -606,41 +689,37 @@ class UIViewHostApi { } } -class _UIScrollViewHostApiCodec extends StandardMessageCodec { - const _UIScrollViewHostApiCodec(); -} - +/// Mirror of UIScrollView. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. class UIScrollViewHostApi { /// Constructor for [UIScrollViewHostApi]. 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. UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _UIScrollViewHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future createFromWebView( int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = + final List? replyList = await channel.send([arg_identifier, arg_webViewIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -651,28 +730,26 @@ class UIScrollViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as List?)!.cast(); + return (replyList[0] as List?)!.cast(); } } @@ -680,21 +757,18 @@ class UIScrollViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_x, arg_y]) - as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_x, arg_y]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -706,21 +780,18 @@ class UIScrollViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_x, arg_y]) - as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_x, arg_y]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -752,13 +823,15 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebViewConfiguration. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. class WKWebViewConfigurationHostApi { /// Constructor for [WKWebViewConfigurationHostApi]. 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. WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = @@ -768,20 +841,18 @@ class WKWebViewConfigurationHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -794,21 +865,19 @@ class WKWebViewConfigurationHostApi { 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = + final List? replyList = await channel.send([arg_identifier, arg_webViewIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -821,20 +890,18 @@ class WKWebViewConfigurationHostApi { 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_allow]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_allow]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -847,20 +914,18 @@ class WKWebViewConfigurationHostApi { 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_types]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_types]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -868,15 +933,14 @@ class WKWebViewConfigurationHostApi { } } -class _WKWebViewConfigurationFlutterApiCodec extends StandardMessageCodec { - const _WKWebViewConfigurationFlutterApiCodec(); -} - +/// Handles callbacks from an WKWebViewConfiguration instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. abstract class WKWebViewConfigurationFlutterApi { - static const MessageCodec codec = - _WKWebViewConfigurationFlutterApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); + static void setup(WKWebViewConfigurationFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -931,13 +995,15 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKUserContentController. +/// +/// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. class WKUserContentControllerHostApi { /// Constructor for [WKUserContentControllerHostApi]. 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. WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = @@ -949,21 +1015,19 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -976,21 +1040,19 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_handlerIdentifier, arg_name]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1003,20 +1065,18 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_name]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_name]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1028,20 +1088,18 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1054,21 +1112,18 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_userScript]) - as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_userScript]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1080,20 +1135,18 @@ class WKUserContentControllerHostApi { 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1101,20 +1154,18 @@ class WKUserContentControllerHostApi { } } -class _WKPreferencesHostApiCodec extends StandardMessageCodec { - const _WKPreferencesHostApiCodec(); -} - +/// Mirror of WKUserPreferences. +/// +/// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. class WKPreferencesHostApi { /// Constructor for [WKPreferencesHostApi]. 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. WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKPreferencesHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future createFromWebViewConfiguration( int arg_identifier, int arg_configurationIdentifier) async { @@ -1122,21 +1173,19 @@ class WKPreferencesHostApi { 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1148,20 +1197,18 @@ class WKPreferencesHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_enabled]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_enabled]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1169,40 +1216,35 @@ class WKPreferencesHostApi { } } -class _WKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { - const _WKScriptMessageHandlerHostApiCodec(); -} - +/// Mirror of WKScriptMessageHandler. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. class WKScriptMessageHandlerHostApi { /// Constructor for [WKScriptMessageHandlerHostApi]. 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. WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1234,12 +1276,16 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { } } +/// Handles callbacks from an WKScriptMessageHandler instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. abstract class WKScriptMessageHandlerFlutterApi { static const MessageCodec codec = _WKScriptMessageHandlerFlutterApiCodec(); void didReceiveScriptMessage(int identifier, int userContentControllerIdentifier, WKScriptMessageData message); + static void setup(WKScriptMessageHandlerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1273,40 +1319,35 @@ abstract class WKScriptMessageHandlerFlutterApi { } } -class _WKNavigationDelegateHostApiCodec extends StandardMessageCodec { - const _WKNavigationDelegateHostApiCodec(); -} - +/// Mirror of WKNavigationDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. class WKNavigationDelegateHostApi { /// Constructor for [WKNavigationDelegateHostApi]. 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. WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1362,23 +1403,32 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { } } +/// Handles callbacks from an WKNavigationDelegate instance. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. abstract class WKNavigationDelegateFlutterApi { static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); void didFinishNavigation(int identifier, int webViewIdentifier, String? url); + void didStartProvisionalNavigation( int identifier, int webViewIdentifier, String? url); + Future decidePolicyForNavigationAction( int identifier, int webViewIdentifier, WKNavigationActionData navigationAction); + void didFailNavigation( int identifier, int webViewIdentifier, NSErrorData error); + void didFailProvisionalNavigation( int identifier, int webViewIdentifier, NSErrorData error); + void webViewWebContentProcessDidTerminate( int identifier, int webViewIdentifier); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1565,13 +1615,15 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { } } +/// Mirror of NSObject. +/// +/// See https://developer.apple.com/documentation/objectivec/nsobject. class NSObjectHostApi { /// Constructor for [NSObjectHostApi]. 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. NSObjectHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _NSObjectHostApiCodec(); @@ -1580,20 +1632,18 @@ class NSObjectHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1608,24 +1658,22 @@ class NSObjectHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ + final List? replyList = await channel.send([ arg_identifier, arg_observerIdentifier, arg_keyPath, arg_options - ]) as Map?; - if (replyMap == null) { + ]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1637,21 +1685,19 @@ class NSObjectHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( + final List? replyList = await channel.send( [arg_identifier, arg_observerIdentifier, arg_keyPath]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1761,6 +1807,9 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { } } +/// Handles callbacks from an NSObject instance. +/// +/// See https://developer.apple.com/documentation/objectivec/nsobject. abstract class NSObjectFlutterApi { static const MessageCodec codec = _NSObjectFlutterApiCodec(); @@ -1770,7 +1819,9 @@ abstract class NSObjectFlutterApi { int objectIdentifier, List changeKeys, List changeValues); + void dispose(int identifier); + static void setup(NSObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1931,13 +1982,15 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebView. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. class WKWebViewHostApi { /// Constructor for [WKWebViewHostApi]. 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. WKWebViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); @@ -1947,21 +2000,19 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_configurationIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1973,21 +2024,19 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = + final List? replyList = await channel.send([arg_identifier, arg_uiDelegateIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -1999,21 +2048,19 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_navigationDelegateIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2024,23 +2071,21 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as String?); + return (replyList[0] as String?); } } @@ -2048,28 +2093,26 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as double?)!; + return (replyList[0] as double?)!; } } @@ -2078,20 +2121,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_request]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_request]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2103,21 +2144,19 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = + final List? replyList = await channel.send([arg_identifier, arg_string, arg_baseUrl]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2129,21 +2168,19 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_url, arg_readAccessUrl]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2154,20 +2191,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_key]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_key]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2178,28 +2213,26 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as bool?)!; + return (replyList[0] as bool?)!; } } @@ -2207,28 +2240,26 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as bool?)!; + return (replyList[0] as bool?)!; } } @@ -2236,20 +2267,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2260,20 +2289,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2284,20 +2311,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2308,23 +2333,21 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as String?); + return (replyList[0] as String?); } } @@ -2334,20 +2357,18 @@ class WKWebViewHostApi { 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_allow]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_allow]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2359,21 +2380,18 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_userAgent]) - as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_userAgent]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2385,61 +2403,55 @@ class WKWebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = + final List? replyList = await channel.send([arg_identifier, arg_javaScriptString]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as Object?); + return (replyList[0] as Object?); } } } -class _WKUIDelegateHostApiCodec extends StandardMessageCodec { - const _WKUIDelegateHostApiCodec(); -} - +/// Mirror of WKUIDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. class WKUIDelegateHostApi { /// Constructor for [WKUIDelegateHostApi]. 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. WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKUIDelegateHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); Future create(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier]) as Map?; - if (replyMap == null) { + 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 (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2483,11 +2495,15 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { } } +/// Handles callbacks from an WKUIDelegate instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. abstract class WKUIDelegateFlutterApi { static const MessageCodec codec = _WKUIDelegateFlutterApiCodec(); void onCreateWebView(int identifier, int webViewIdentifier, int configurationIdentifier, WKNavigationActionData navigationAction); + static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -2553,13 +2569,15 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKHttpCookieStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. class WKHttpCookieStoreHostApi { /// Constructor for [WKHttpCookieStoreHostApi]. 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. WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); @@ -2570,21 +2588,19 @@ class WKHttpCookieStoreHostApi { 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel + final List? replyList = await channel .send([arg_identifier, arg_websiteDataStoreIdentifier]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -2596,20 +2612,18 @@ class WKHttpCookieStoreHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_cookie]) as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_identifier, arg_cookie]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart index 566c46fda8bb..467fa8735d6b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart @@ -10,6 +10,8 @@ import '../foundation/foundation.dart'; import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; +export 'web_kit_api_impls.dart' show WKNavigationType; + /// Times at which to inject script content into a webpage. /// /// Wraps [WKUserScriptInjectionTime](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc). @@ -144,13 +146,20 @@ class WKWebsiteDataRecord { @immutable class WKNavigationAction { /// Constructs a [WKNavigationAction]. - const WKNavigationAction({required this.request, required this.targetFrame}); + const WKNavigationAction({ + required this.request, + required this.targetFrame, + required this.navigationType, + }); /// The URL request object associated with the navigation action. final NSUrlRequest request; /// The frame in which to display the new content. final WKFrameInfo targetFrame; + + /// The type of action that triggered the navigation. + final WKNavigationType navigationType; } /// An object that contains information about a frame on a webpage. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart index 614d0793e5f9..97a3e0008f81 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit_api_impls.dart @@ -10,6 +10,8 @@ import '../common/web_kit.pigeon.dart'; import '../foundation/foundation.dart'; import 'web_kit.dart'; +export '../common/web_kit.pigeon.dart' show WKNavigationType; + Iterable _toWKWebsiteDataTypeEnumData( Iterable types) { return types.map((WKWebsiteDataType type) { @@ -169,6 +171,7 @@ extension _NavigationActionDataConverter on WKNavigationActionData { return WKNavigationAction( request: request.toNSUrlRequest(), targetFrame: targetFrame.toWKFrameInfo(), + navigationType: navigationType, ); } } 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 c20a10ebfadd..d32693ee5698 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -166,6 +166,42 @@ class NSHttpCookiePropertyKeyEnumData { late NSHttpCookiePropertyKeyEnum value; } +/// An object that contains information about an action that causes navigation +/// to occur. +/// +/// Wraps [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +enum WKNavigationType { + /// A link activation. + /// + /// 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. + other, +} + /// Mirror of NSURLRequest. /// /// See https://developer.apple.com/documentation/foundation/nsurlrequest?language=objc. @@ -191,6 +227,7 @@ class WKUserScriptData { class WKNavigationActionData { late NSUrlRequestData request; late WKFrameInfoData targetFrame; + late WKNavigationType navigationType; } /// Mirror of WKFrameInfo. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index bf443e878a3e..27a6a7863806 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/plugins/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.0.0 +version: 3.0.1 environment: sdk: ">=2.17.0 <3.0.0" @@ -29,4 +29,4 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.3.2 - pigeon: ^3.0.3 + pigeon: ^4.2.13 diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart index b64c1422b825..da7ce9b18aef 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart @@ -152,6 +152,7 @@ void main() { const WKNavigationAction( request: request, targetFrame: WKFrameInfo(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ); @@ -1167,6 +1168,7 @@ void main() { const WKNavigationAction( request: NSUrlRequest(url: 'https://google.com'), targetFrame: WKFrameInfo(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ), completion(WKNavigationActionPolicy.allow), diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart index a9e5c8bb1db4..73c1053f517d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart @@ -1,14 +1,13 @@ // Copyright 2013 The Flutter 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 (v3.1.5), do not edit directly. +// Autogenerated from Pigeon (v4.2.13), 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 +// 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 -// @dart = 2.12 import 'dart:async'; -import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; -import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -38,17 +37,23 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebsiteDataStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. abstract class TestWKWebsiteDataStoreHostApi { static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); void createFromWebViewConfiguration( int identifier, int configurationIdentifier); + void createDefaultDataStore(int identifier); + Future removeDataOfTypes( int identifier, List dataTypes, double modificationTimeInSecondsSinceEpoch); + static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -71,7 +76,7 @@ abstract class TestWKWebsiteDataStoreHostApi { 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); api.createFromWebViewConfiguration( arg_identifier!, arg_configurationIdentifier!); - return {}; + return []; }); } } @@ -91,7 +96,7 @@ abstract class TestWKWebsiteDataStoreHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_identifier!); - return {}; + return []; }); } } @@ -120,22 +125,23 @@ abstract class TestWKWebsiteDataStoreHostApi { '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 {'result': output}; + return [output]; }); } } } } -class _TestUIViewHostApiCodec extends StandardMessageCodec { - const _TestUIViewHostApiCodec(); -} - +/// Mirror of UIView. +/// +/// See https://developer.apple.com/documentation/uikit/uiview?language=objc. abstract class TestUIViewHostApi { - static const MessageCodec codec = _TestUIViewHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void setBackgroundColor(int identifier, int? value); + void setOpaque(int identifier, bool opaque); + static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -154,7 +160,7 @@ abstract class TestUIViewHostApi { '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 {}; + return []; }); } } @@ -176,24 +182,27 @@ abstract class TestUIViewHostApi { assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_identifier!, arg_opaque!); - return {}; + return []; }); } } } } -class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { - const _TestUIScrollViewHostApiCodec(); -} - +/// Mirror of UIScrollView. +/// +/// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. abstract class TestUIScrollViewHostApi { - static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void createFromWebView(int identifier, int webViewIdentifier); + List getContentOffset(int identifier); + void scrollBy(int identifier, double x, double y); + void setContentOffset(int identifier, double x, double y); + static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -214,7 +223,7 @@ abstract class TestUIScrollViewHostApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return {}; + return []; }); } } @@ -233,7 +242,7 @@ abstract class TestUIScrollViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -258,7 +267,7 @@ abstract class TestUIScrollViewHostApi { 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 {}; + return []; }); } } @@ -283,7 +292,7 @@ abstract class TestUIScrollViewHostApi { 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 {}; + return []; }); } } @@ -314,15 +323,22 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebViewConfiguration. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. abstract class TestWKWebViewConfigurationHostApi { static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); void create(int identifier); + void createFromWebView(int identifier, int webViewIdentifier); + void setAllowsInlineMediaPlayback(int identifier, bool allow); + void setMediaTypesRequiringUserActionForPlayback( int identifier, List types); + static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -340,7 +356,7 @@ abstract class TestWKWebViewConfigurationHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); - return {}; + return []; }); } } @@ -363,7 +379,7 @@ abstract class TestWKWebViewConfigurationHostApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return {}; + return []; }); } } @@ -386,7 +402,7 @@ abstract class TestWKWebViewConfigurationHostApi { assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); - return {}; + return []; }); } } @@ -412,7 +428,7 @@ abstract class TestWKWebViewConfigurationHostApi { 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); api.setMediaTypesRequiringUserActionForPlayback( arg_identifier!, arg_types!); - return {}; + return []; }); } } @@ -449,18 +465,27 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKUserContentController. +/// +/// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. abstract class TestWKUserContentControllerHostApi { static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); void createFromWebViewConfiguration( int identifier, int configurationIdentifier); + void addScriptMessageHandler( int identifier, int handlerIdentifier, String name); + void removeScriptMessageHandler(int identifier, String name); + void removeAllScriptMessageHandlers(int identifier); + void addUserScript(int identifier, WKUserScriptData userScript); + void removeAllUserScripts(int identifier); + static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -483,7 +508,7 @@ abstract class TestWKUserContentControllerHostApi { 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); api.createFromWebViewConfiguration( arg_identifier!, arg_configurationIdentifier!); - return {}; + return []; }); } } @@ -510,7 +535,7 @@ abstract class TestWKUserContentControllerHostApi { 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); api.addScriptMessageHandler( arg_identifier!, arg_handlerIdentifier!, arg_name!); - return {}; + return []; }); } } @@ -533,7 +558,7 @@ abstract class TestWKUserContentControllerHostApi { assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_identifier!, arg_name!); - return {}; + return []; }); } } @@ -553,7 +578,7 @@ abstract class TestWKUserContentControllerHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_identifier!); - return {}; + return []; }); } } @@ -577,7 +602,7 @@ abstract class TestWKUserContentControllerHostApi { assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_identifier!, arg_userScript!); - return {}; + return []; }); } } @@ -597,23 +622,24 @@ abstract class TestWKUserContentControllerHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_identifier!); - return {}; + return []; }); } } } } -class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { - const _TestWKPreferencesHostApiCodec(); -} - +/// Mirror of WKUserPreferences. +/// +/// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. abstract class TestWKPreferencesHostApi { - static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void createFromWebViewConfiguration( int identifier, int configurationIdentifier); + void setJavaScriptEnabled(int identifier, bool enabled); + static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -636,7 +662,7 @@ abstract class TestWKPreferencesHostApi { 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); api.createFromWebViewConfiguration( arg_identifier!, arg_configurationIdentifier!); - return {}; + return []; }); } } @@ -658,22 +684,21 @@ abstract class TestWKPreferencesHostApi { assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); - return {}; + return []; }); } } } } -class _TestWKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { - const _TestWKScriptMessageHandlerHostApiCodec(); -} - +/// Mirror of WKScriptMessageHandler. +/// +/// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. abstract class TestWKScriptMessageHandlerHostApi { - static const MessageCodec codec = - _TestWKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); + static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -691,22 +716,21 @@ abstract class TestWKScriptMessageHandlerHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); - return {}; + return []; }); } } } } -class _TestWKNavigationDelegateHostApiCodec extends StandardMessageCodec { - const _TestWKNavigationDelegateHostApiCodec(); -} - +/// Mirror of WKNavigationDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. abstract class TestWKNavigationDelegateHostApi { - static const MessageCodec codec = - _TestWKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); + static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -724,7 +748,7 @@ abstract class TestWKNavigationDelegateHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); - return {}; + return []; }); } } @@ -755,13 +779,19 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { } } +/// Mirror of NSObject. +/// +/// See https://developer.apple.com/documentation/objectivec/nsobject. abstract class TestNSObjectHostApi { static const MessageCodec codec = _TestNSObjectHostApiCodec(); void dispose(int identifier); + 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}) { { @@ -779,7 +809,7 @@ abstract class TestNSObjectHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); - return {}; + return []; }); } } @@ -810,7 +840,7 @@ abstract class TestNSObjectHostApi { 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); api.addObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!, arg_options!); - return {}; + return []; }); } } @@ -836,7 +866,7 @@ abstract class TestNSObjectHostApi { 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); api.removeObserver( arg_identifier!, arg_observerIdentifier!, arg_keyPath!); - return {}; + return []; }); } } @@ -945,27 +975,48 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKWebView. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); void create(int identifier, int configurationIdentifier); + void setUIDelegate(int identifier, int? uiDelegateIdentifier); + void setNavigationDelegate(int identifier, int? navigationDelegateIdentifier); + String? getUrl(int identifier); + double getEstimatedProgress(int identifier); + void loadRequest(int identifier, NSUrlRequestData request); + void loadHtmlString(int identifier, String string, String? baseUrl); + void loadFileUrl(int identifier, String url, String readAccessUrl); + void loadFlutterAsset(int identifier, String key); + bool canGoBack(int identifier); + bool canGoForward(int identifier); + void goBack(int identifier); + void goForward(int identifier); + void reload(int identifier); + String? getTitle(int identifier); + void setAllowsBackForwardNavigationGestures(int identifier, bool allow); + void setCustomUserAgent(int identifier, String? userAgent); + Future evaluateJavaScript(int identifier, String javaScriptString); + static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -986,7 +1037,7 @@ abstract class TestWKWebViewHostApi { assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_identifier!, arg_configurationIdentifier!); - return {}; + return []; }); } } @@ -1006,7 +1057,7 @@ abstract class TestWKWebViewHostApi { '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 {}; + return []; }); } } @@ -1027,7 +1078,7 @@ abstract class TestWKWebViewHostApi { final int? arg_navigationDelegateIdentifier = (args[1] as int?); api.setNavigationDelegate( arg_identifier!, arg_navigationDelegateIdentifier); - return {}; + return []; }); } } @@ -1046,7 +1097,7 @@ abstract class TestWKWebViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -1065,7 +1116,7 @@ abstract class TestWKWebViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -1087,7 +1138,7 @@ abstract class TestWKWebViewHostApi { assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_identifier!, arg_request!); - return {}; + return []; }); } } @@ -1110,7 +1161,7 @@ abstract class TestWKWebViewHostApi { '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 {}; + return []; }); } } @@ -1135,7 +1186,7 @@ abstract class TestWKWebViewHostApi { 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 {}; + return []; }); } } @@ -1157,7 +1208,7 @@ abstract class TestWKWebViewHostApi { assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_identifier!, arg_key!); - return {}; + return []; }); } } @@ -1176,7 +1227,7 @@ abstract class TestWKWebViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -1195,7 +1246,7 @@ abstract class TestWKWebViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -1214,7 +1265,7 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_identifier!); - return {}; + return []; }); } } @@ -1233,7 +1284,7 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_identifier!); - return {}; + return []; }); } } @@ -1252,7 +1303,7 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_identifier!); - return {}; + return []; }); } } @@ -1271,7 +1322,7 @@ abstract class TestWKWebViewHostApi { 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 {'result': output}; + return [output]; }); } } @@ -1295,7 +1346,7 @@ abstract class TestWKWebViewHostApi { 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); api.setAllowsBackForwardNavigationGestures( arg_identifier!, arg_allow!); - return {}; + return []; }); } } @@ -1315,7 +1366,7 @@ abstract class TestWKWebViewHostApi { '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 {}; + return []; }); } } @@ -1338,21 +1389,21 @@ abstract class TestWKWebViewHostApi { 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); final Object? output = await api.evaluateJavaScript( arg_identifier!, arg_javaScriptString!); - return {'result': output}; + return [output]; }); } } } } -class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { - const _TestWKUIDelegateHostApiCodec(); -} - +/// Mirror of WKUIDelegate. +/// +/// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. abstract class TestWKUIDelegateHostApi { - static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); + static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1370,7 +1421,7 @@ abstract class TestWKUIDelegateHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); - return {}; + return []; }); } } @@ -1407,13 +1458,18 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { } } +/// Mirror of WKHttpCookieStore. +/// +/// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. abstract class TestWKHttpCookieStoreHostApi { static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); void createFromWebsiteDataStore( int identifier, int websiteDataStoreIdentifier); + Future setCookie(int identifier, NSHttpCookieData cookie); + static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1436,7 +1492,7 @@ abstract class TestWKHttpCookieStoreHostApi { 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); api.createFromWebsiteDataStore( arg_identifier!, arg_websiteDataStoreIdentifier!); - return {}; + return []; }); } } @@ -1458,7 +1514,7 @@ abstract class TestWKHttpCookieStoreHostApi { 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 {}; + return []; }); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart index 4000e0d718da..a2b456ee5898 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart @@ -575,6 +575,7 @@ void main() { allHttpHeaderFields: {}, ), targetFrame: WKFrameInfoData(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ); @@ -922,6 +923,7 @@ void main() { allHttpHeaderFields: {}, ), targetFrame: WKFrameInfoData(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart index 731819f1dac8..62889b0dd4af 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart @@ -200,6 +200,7 @@ void main() { const WKNavigationAction( request: NSUrlRequest(url: 'https://www.google.com'), targetFrame: WKFrameInfo(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ), completion(WKNavigationActionPolicy.allow), @@ -229,6 +230,7 @@ void main() { const WKNavigationAction( request: request, targetFrame: WKFrameInfo(isMainFrame: false), + navigationType: WKNavigationType.linkActivated, ), ); From 15cfe8aa2b22b7b14ae6d9a0e407817c7aaf7617 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 21 Dec 2022 17:23:37 -0500 Subject: [PATCH 2/3] [webview_flutter_android] Adds support for selecting Hybrid Composition (#6864) * add displayWithHybridComposition flag * move duplicate method * unit tests * adds * update docs * create platformviewsserviceproxy * use proxy for platformviewsservice * remove usused code * update display mode * use clever imports --- .../webview_flutter_android/CHANGELOG.md | 5 + .../webview_flutter_android/README.md | 25 + .../webview_flutter_test.dart | 1 - .../lib/src/android_webview_controller.dart | 100 +- .../lib/src/platform_views_service_proxy.dart | 53 + .../webview_flutter_android/pubspec.yaml | 2 +- .../test/android_webview_controller_test.dart | 118 +- ...android_webview_controller_test.mocks.dart | 1170 ++++++++++++----- 8 files changed, 1110 insertions(+), 364 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_android/lib/src/platform_views_service_proxy.dart diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index a7a820db3141..fe285b8f5867 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.1.0 + +* Adds support for selecting Hybrid Composition on versions 23+. Please use + `AndroidWebViewControllerCreationParams.displayWithHybridComposition`. + ## 3.0.0 * **BREAKING CHANGE** Updates platform implementation to `2.0.0` release of diff --git a/packages/webview_flutter/webview_flutter_android/README.md b/packages/webview_flutter/webview_flutter_android/README.md index bdd9edf99eaa..1a54808379fb 100644 --- a/packages/webview_flutter/webview_flutter_android/README.md +++ b/packages/webview_flutter/webview_flutter_android/README.md @@ -7,6 +7,31 @@ The Android implementation of [`webview_flutter`][1]. This package is [endorsed][2], which means you can simply use `webview_flutter` normally. This package will be automatically included in your app when you do. +## Display Mode + +This plugin supports two different platform view display modes. The default display mode is subject +to change in the future, and will not be considered a breaking change, so if you want to ensure a +specific mode, you can set it explicitly. + +### Texture Layer Hybrid Composition + +This is the current default mode for versions >=23. This is a new display mode used by most +plugins starting with Flutter 3.0. This is more performant than Hybrid Composition, but has some +limitations from using an Android [SurfaceTexture](https://developer.android.com/reference/android/graphics/SurfaceTexture). +See: +* https://github.com/flutter/flutter/issues/104889 +* https://github.com/flutter/flutter/issues/116954 + +### Hybrid Composition + +This is the current default mode for versions <23. It ensures that the WebView will display and work +as expected, at the cost of some performance. See: +* https://flutter.dev/docs/development/platform-integration/platform-views#performance + +This can be configured for versions >=23 with +`AndroidWebViewWidgetCreationParams.displayWithHybridComposition`. See https://pub.dev/packages/webview_flutter#platform-specific-features +for more details on setting platform-specific features in the main plugin. + ## Contributing This package uses [pigeon][3] to generate the communication layer between Flutter and the host 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 6326f10fcc31..dcd1dead700d 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 @@ -13,7 +13,6 @@ import 'dart:io'; // ignore: unnecessary_import import 'dart:typed_data'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; 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 2cb01d41976e..2e32705a83ea 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 @@ -16,6 +16,7 @@ import 'android_proxy.dart'; import 'android_webview.dart' as android_webview; import 'android_webview.dart'; import 'instance_manager.dart'; +import 'platform_views_service_proxy.dart'; import 'weak_reference_utils.dart'; /// Object specifying creation parameters for creating a [AndroidWebViewController]. @@ -369,20 +370,28 @@ class AndroidWebViewWidgetCreationParams required super.controller, super.layoutDirection, super.gestureRecognizers, + this.displayWithHybridComposition = false, @visibleForTesting InstanceManager? instanceManager, + @visibleForTesting + this.platformViewsServiceProxy = const PlatformViewsServiceProxy(), }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; /// Constructs a [WebKitWebViewWidgetCreationParams] using a /// [PlatformWebViewWidgetCreationParams]. AndroidWebViewWidgetCreationParams.fromPlatformWebViewWidgetCreationParams( PlatformWebViewWidgetCreationParams params, { - InstanceManager? instanceManager, + bool displayWithHybridComposition = false, + @visibleForTesting InstanceManager? instanceManager, + @visibleForTesting PlatformViewsServiceProxy platformViewsServiceProxy = + const PlatformViewsServiceProxy(), }) : this( key: params.key, controller: params.controller, layoutDirection: params.layoutDirection, gestureRecognizers: params.gestureRecognizers, + displayWithHybridComposition: displayWithHybridComposition, instanceManager: instanceManager, + platformViewsServiceProxy: platformViewsServiceProxy, ); /// Maintains instances used to communicate with the native objects they @@ -392,6 +401,25 @@ class AndroidWebViewWidgetCreationParams /// outside of tests. @visibleForTesting final InstanceManager instanceManager; + + /// Proxy that provides access to the platform views service. + /// + /// This service allows creating and controlling platform-specific views. + @visibleForTesting + final PlatformViewsServiceProxy platformViewsServiceProxy; + + /// Whether the [WebView] will be displayed using the Hybrid Composition + /// PlatformView implementation. + /// + /// For most use cases, this flag should be set to false. Hybrid Composition + /// can have performance costs but doesn't have the limitation of rendering to + /// an Android SurfaceTexture. See + /// * https://flutter.dev/docs/development/platform-integration/platform-views#performance + /// * https://github.com/flutter/flutter/issues/104889 + /// * https://github.com/flutter/flutter/issues/116954 + /// + /// Defaults to false. + final bool displayWithHybridComposition; } /// An implementation of [PlatformWebViewWidget] with the Android WebView API. @@ -411,30 +439,52 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { @override Widget build(BuildContext context) { return PlatformViewLink( - key: _androidParams.key, + key: _androidParams.key, + viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return AndroidViewSurface( + controller: controller as AndroidViewController, + gestureRecognizers: _androidParams.gestureRecognizers, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initAndroidView( + params, + displayWithHybridComposition: + _androidParams.displayWithHybridComposition, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + + AndroidViewController _initAndroidView( + PlatformViewCreationParams params, { + required bool displayWithHybridComposition, + }) { + if (displayWithHybridComposition) { + return _androidParams.platformViewsServiceProxy.initExpensiveAndroidView( + id: params.id, viewType: 'plugins.flutter.io/webview', - surfaceFactory: ( - BuildContext context, - PlatformViewController controller, - ) { - return AndroidViewSurface( - controller: controller as AndroidViewController, - gestureRecognizers: _androidParams.gestureRecognizers, - hitTestBehavior: PlatformViewHitTestBehavior.opaque, - ); - }, - onCreatePlatformView: (PlatformViewCreationParams params) { - return PlatformViewsService.initSurfaceAndroidView( - id: params.id, - viewType: 'plugins.flutter.io/webview', - layoutDirection: _androidParams.layoutDirection, - creationParams: _androidParams.instanceManager.getIdentifier( - (_androidParams.controller as AndroidWebViewController) - ._webView), - creationParamsCodec: const StandardMessageCodec(), - ) - ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) - ..create(); - }); + layoutDirection: _androidParams.layoutDirection, + creationParams: _androidParams.instanceManager.getIdentifier( + (_androidParams.controller as AndroidWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } else { + return _androidParams.platformViewsServiceProxy.initSurfaceAndroidView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: _androidParams.layoutDirection, + creationParams: _androidParams.instanceManager.getIdentifier( + (_androidParams.controller as AndroidWebViewController)._webView), + creationParamsCodec: const StandardMessageCodec(), + ); + } } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/platform_views_service_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/platform_views_service_proxy.dart new file mode 100644 index 000000000000..7011f335a269 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/lib/src/platform_views_service_proxy.dart @@ -0,0 +1,53 @@ +// Copyright 2013 The Flutter Authors. 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/material.dart'; +import 'package:flutter/services.dart'; + +/// Proxy that provides access to the platform views service. +/// +/// This service allows creating and controlling platform-specific views. +@immutable +class PlatformViewsServiceProxy { + /// Constructs a [PlatformViewsServiceProxy]. + const PlatformViewsServiceProxy(); + + /// Proxy method for [PlatformViewsService.initExpensiveAndroidView]. + ExpensiveAndroidViewController initExpensiveAndroidView({ + required int id, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + VoidCallback? onFocus, + }) { + return PlatformViewsService.initExpensiveAndroidView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); + } + + /// Proxy method for [PlatformViewsService.initSurfaceAndroidView]. + SurfaceAndroidViewController initSurfaceAndroidView({ + required int id, + required String viewType, + required TextDirection layoutDirection, + dynamic creationParams, + MessageCodec? creationParamsCodec, + VoidCallback? onFocus, + }) { + return PlatformViewsService.initSurfaceAndroidView( + id: id, + viewType: viewType, + layoutDirection: layoutDirection, + creationParams: creationParams, + creationParamsCodec: creationParamsCodec, + onFocus: onFocus, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 4b22a1f3998e..cf6939ae1c55 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/plugins/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.0.0 +version: 3.1.0 environment: sdk: ">=2.17.0 <3.0.0" 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 4b74f3af3390..0e7842ab467d 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 @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/foundation.dart'; +// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231) +// ignore: unnecessary_import +import 'dart:typed_data'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -12,6 +15,7 @@ import 'package:webview_flutter_android/src/android_proxy.dart'; import 'package:webview_flutter_android/src/android_webview.dart' as android_webview; import 'package:webview_flutter_android/src/instance_manager.dart'; +import 'package:webview_flutter_android/src/platform_views_service_proxy.dart'; import 'package:webview_flutter_android/webview_flutter_android.dart'; import 'package:webview_flutter_platform_interface/src/webview_platform.dart'; @@ -22,8 +26,11 @@ import 'android_webview_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), MockSpec(), + MockSpec(), + MockSpec(), MockSpec(), MockSpec(), MockSpec(), @@ -770,22 +777,16 @@ void main() { }); group('AndroidWebViewWidget', () { - testWidgets('Builds AndroidView using supplied parameters', + testWidgets('Builds Android view using supplied parameters', (WidgetTester tester) async { - final MockAndroidWebViewWidgetCreationParams mockParams = - MockAndroidWebViewWidgetCreationParams(); - final MockInstanceManager mockInstanceManager = MockInstanceManager(); - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = - createControllerWithMocks(mockWebView: mockWebView); - - when(mockParams.key).thenReturn(const Key('test_web_view')); - when(mockParams.instanceManager).thenReturn(mockInstanceManager); - when(mockParams.controller).thenReturn(controller); - when(mockInstanceManager.getIdentifier(mockWebView)).thenReturn(42); + final AndroidWebViewController controller = createControllerWithMocks(); - final AndroidWebViewWidget webViewWidget = - AndroidWebViewWidget(mockParams); + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + ), + ); await tester.pumpWidget(Builder( builder: (BuildContext context) => webViewWidget.build(context), @@ -794,5 +795,92 @@ void main() { expect(find.byType(PlatformViewLink), findsOneWidget); expect(find.byKey(const Key('test_web_view')), findsOneWidget); }); + + testWidgets('displayWithHybridComposition is false', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + + testWidgets('displayWithHybridComposition is true', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockExpensiveAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + displayWithHybridComposition: true, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); }); } 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 d6147a543ef1..643f5ac964b1 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 @@ -3,20 +3,24 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i7; -import 'dart:typed_data' as _i12; +import 'dart:async' as _i9; +import 'dart:typed_data' as _i15; import 'dart:ui' as _i4; -import 'package:flutter/foundation.dart' as _i10; -import 'package:flutter/gestures.dart' as _i11; +import 'package:flutter/foundation.dart' as _i12; +import 'package:flutter/gestures.dart' as _i13; +import 'package:flutter/material.dart' as _i14; +import 'package:flutter/services.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_android/src/android_navigation_delegate.dart' - as _i6; -import 'package:webview_flutter_android/src/android_proxy.dart' as _i9; + as _i8; +import 'package:webview_flutter_android/src/android_proxy.dart' as _i11; import 'package:webview_flutter_android/src/android_webview.dart' as _i2; import 'package:webview_flutter_android/src/android_webview_controller.dart' - as _i8; + as _i10; import 'package:webview_flutter_android/src/instance_manager.dart' as _i5; +import 'package:webview_flutter_android/src/platform_views_service_proxy.dart' + as _i6; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' as _i3; @@ -148,9 +152,52 @@ class _FakeInstanceManager_10 extends _i1.SmartFake ); } -class _FakePlatformWebViewController_11 extends _i1.SmartFake +class _FakePlatformViewsServiceProxy_11 extends _i1.SmartFake + implements _i6.PlatformViewsServiceProxy { + _FakePlatformViewsServiceProxy_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePlatformWebViewController_12 extends _i1.SmartFake implements _i3.PlatformWebViewController { - _FakePlatformWebViewController_11( + _FakePlatformWebViewController_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSize_13 extends _i1.SmartFake implements _i4.Size { + _FakeSize_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeExpensiveAndroidViewController_14 extends _i1.SmartFake + implements _i7.ExpensiveAndroidViewController { + _FakeExpensiveAndroidViewController_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSurfaceAndroidViewController_15 extends _i1.SmartFake + implements _i7.SurfaceAndroidViewController { + _FakeSurfaceAndroidViewController_15( Object parent, Invocation parentInvocation, ) : super( @@ -159,8 +206,8 @@ class _FakePlatformWebViewController_11 extends _i1.SmartFake ); } -class _FakeWebSettings_12 extends _i1.SmartFake implements _i2.WebSettings { - _FakeWebSettings_12( +class _FakeWebSettings_16 extends _i1.SmartFake implements _i2.WebSettings { + _FakeWebSettings_16( Object parent, Invocation parentInvocation, ) : super( @@ -169,8 +216,8 @@ class _FakeWebSettings_12 extends _i1.SmartFake implements _i2.WebSettings { ); } -class _FakeWebStorage_13 extends _i1.SmartFake implements _i2.WebStorage { - _FakeWebStorage_13( +class _FakeWebStorage_17 extends _i1.SmartFake implements _i2.WebStorage { + _FakeWebStorage_17( Object parent, Invocation parentInvocation, ) : super( @@ -183,7 +230,7 @@ class _FakeWebStorage_13 extends _i1.SmartFake implements _i2.WebStorage { /// /// See the documentation for Mockito's code generation for more information. class MockAndroidNavigationDelegate extends _i1.Mock - implements _i6.AndroidNavigationDelegate { + implements _i8.AndroidNavigationDelegate { @override _i2.WebChromeClient get androidWebChromeClient => (super.noSuchMethod( Invocation.getter(#androidWebChromeClient), @@ -235,74 +282,74 @@ class MockAndroidNavigationDelegate extends _i1.Mock ), ) as _i3.PlatformNavigationDelegateCreationParams); @override - _i7.Future setOnLoadRequest(_i6.LoadRequestCallback? onLoadRequest) => + _i9.Future setOnLoadRequest(_i8.LoadRequestCallback? onLoadRequest) => (super.noSuchMethod( Invocation.method( #setOnLoadRequest, [onLoadRequest], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setOnNavigationRequest( + _i9.Future setOnNavigationRequest( _i3.NavigationRequestCallback? onNavigationRequest) => (super.noSuchMethod( Invocation.method( #setOnNavigationRequest, [onNavigationRequest], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => + _i9.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( Invocation.method( #setOnPageStarted, [onPageStarted], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => + _i9.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( Invocation.method( #setOnPageFinished, [onPageFinished], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setOnProgress(_i3.ProgressCallback? onProgress) => + _i9.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( Invocation.method( #setOnProgress, [onProgress], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setOnWebResourceError( + _i9.Future setOnWebResourceError( _i3.WebResourceErrorCallback? onWebResourceError) => (super.noSuchMethod( Invocation.method( #setOnWebResourceError, [onWebResourceError], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewController]. /// /// See the documentation for Mockito's code generation for more information. class MockAndroidWebViewController extends _i1.Mock - implements _i8.AndroidWebViewController { + implements _i10.AndroidWebViewController { @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), @@ -317,25 +364,25 @@ class MockAndroidWebViewController extends _i1.Mock ), ) as _i3.PlatformWebViewControllerCreationParams); @override - _i7.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( + _i9.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( #loadFile, [absoluteFilePath], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future loadFlutterAsset(String? key) => (super.noSuchMethod( + _i9.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( #loadFlutterAsset, [key], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future loadHtmlString( + _i9.Future loadHtmlString( String? html, { String? baseUrl, }) => @@ -345,165 +392,165 @@ class MockAndroidWebViewController extends _i1.Mock [html], {#baseUrl: baseUrl}, ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future loadRequest(_i3.LoadRequestParams? params) => + _i9.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( Invocation.method( #loadRequest, [params], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future currentUrl() => (super.noSuchMethod( + _i9.Future currentUrl() => (super.noSuchMethod( Invocation.method( #currentUrl, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future canGoBack() => (super.noSuchMethod( + _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( #canGoBack, [], ), - returnValue: _i7.Future.value(false), - returnValueForMissingStub: _i7.Future.value(false), - ) as _i7.Future); + returnValue: _i9.Future.value(false), + returnValueForMissingStub: _i9.Future.value(false), + ) as _i9.Future); @override - _i7.Future canGoForward() => (super.noSuchMethod( + _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( #canGoForward, [], ), - returnValue: _i7.Future.value(false), - returnValueForMissingStub: _i7.Future.value(false), - ) as _i7.Future); + returnValue: _i9.Future.value(false), + returnValueForMissingStub: _i9.Future.value(false), + ) as _i9.Future); @override - _i7.Future goBack() => (super.noSuchMethod( + _i9.Future goBack() => (super.noSuchMethod( Invocation.method( #goBack, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future goForward() => (super.noSuchMethod( + _i9.Future goForward() => (super.noSuchMethod( Invocation.method( #goForward, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future reload() => (super.noSuchMethod( + _i9.Future reload() => (super.noSuchMethod( Invocation.method( #reload, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future clearCache() => (super.noSuchMethod( + _i9.Future clearCache() => (super.noSuchMethod( Invocation.method( #clearCache, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future clearLocalStorage() => (super.noSuchMethod( + _i9.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( #clearLocalStorage, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setPlatformNavigationDelegate( + _i9.Future setPlatformNavigationDelegate( _i3.PlatformNavigationDelegate? handler) => (super.noSuchMethod( Invocation.method( #setPlatformNavigationDelegate, [handler], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future runJavaScript(String? javaScript) => (super.noSuchMethod( + _i9.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( #runJavaScript, [javaScript], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future runJavaScriptReturningResult(String? javaScript) => + _i9.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( Invocation.method( #runJavaScriptReturningResult, [javaScript], ), - returnValue: _i7.Future.value(_FakeObject_5( + returnValue: _i9.Future.value(_FakeObject_5( this, Invocation.method( #runJavaScriptReturningResult, [javaScript], ), )), - returnValueForMissingStub: _i7.Future.value(_FakeObject_5( + returnValueForMissingStub: _i9.Future.value(_FakeObject_5( this, Invocation.method( #runJavaScriptReturningResult, [javaScript], ), )), - ) as _i7.Future); + ) as _i9.Future); @override - _i7.Future addJavaScriptChannel( + _i9.Future addJavaScriptChannel( _i3.JavaScriptChannelParams? javaScriptChannelParams) => (super.noSuchMethod( Invocation.method( #addJavaScriptChannel, [javaScriptChannelParams], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future removeJavaScriptChannel(String? javaScriptChannelName) => + _i9.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( Invocation.method( #removeJavaScriptChannel, [javaScriptChannelName], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future getTitle() => (super.noSuchMethod( + _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( #getTitle, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future scrollTo( + _i9.Future scrollTo( int? x, int? y, ) => @@ -515,11 +562,11 @@ class MockAndroidWebViewController extends _i1.Mock y, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future scrollBy( + _i9.Future scrollBy( int? x, int? y, ) => @@ -531,84 +578,84 @@ class MockAndroidWebViewController extends _i1.Mock y, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( + _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( #getScrollPosition, [], ), - returnValue: _i7.Future<_i4.Offset>.value(_FakeOffset_6( + returnValue: _i9.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, [], ), )), - returnValueForMissingStub: _i7.Future<_i4.Offset>.value(_FakeOffset_6( + returnValueForMissingStub: _i9.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, [], ), )), - ) as _i7.Future<_i4.Offset>); + ) as _i9.Future<_i4.Offset>); @override - _i7.Future enableZoom(bool? enabled) => (super.noSuchMethod( + _i9.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( #enableZoom, [enabled], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( + _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => + _i9.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( Invocation.method( #setJavaScriptMode, [javaScriptMode], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setUserAgent(String? userAgent) => (super.noSuchMethod( + _i9.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( #setUserAgent, [userAgent], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setMediaPlaybackRequiresUserGesture(bool? require) => + _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( Invocation.method( #setMediaPlaybackRequiresUserGesture, [require], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewProxy]. /// /// See the documentation for Mockito's code generation for more information. class MockAndroidWebViewProxy extends _i1.Mock - implements _i9.AndroidWebViewProxy { + implements _i11.AndroidWebViewProxy { @override _i2.WebView Function({required bool useHybridComposition}) get createAndroidWebView => (super.noSuchMethod( @@ -895,15 +942,15 @@ class MockAndroidWebViewProxy extends _i1.Mock ) onDownloadStart})); @override - _i7.Future setWebContentsDebuggingEnabled(bool? enabled) => + _i9.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( Invocation.method( #setWebContentsDebuggingEnabled, [enabled], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewWidgetCreationParams]. @@ -911,7 +958,7 @@ class MockAndroidWebViewProxy extends _i1.Mock /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable class MockAndroidWebViewWidgetCreationParams extends _i1.Mock - implements _i8.AndroidWebViewWidgetCreationParams { + implements _i10.AndroidWebViewWidgetCreationParams { @override _i5.InstanceManager get instanceManager => (super.noSuchMethod( Invocation.getter(#instanceManager), @@ -925,13 +972,32 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock ), ) as _i5.InstanceManager); @override + _i6.PlatformViewsServiceProxy get platformViewsServiceProxy => + (super.noSuchMethod( + Invocation.getter(#platformViewsServiceProxy), + returnValue: _FakePlatformViewsServiceProxy_11( + this, + Invocation.getter(#platformViewsServiceProxy), + ), + returnValueForMissingStub: _FakePlatformViewsServiceProxy_11( + this, + Invocation.getter(#platformViewsServiceProxy), + ), + ) as _i6.PlatformViewsServiceProxy); + @override + bool get displayWithHybridComposition => (super.noSuchMethod( + Invocation.getter(#displayWithHybridComposition), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override _i3.PlatformWebViewController get controller => (super.noSuchMethod( Invocation.getter(#controller), - returnValue: _FakePlatformWebViewController_11( + returnValue: _FakePlatformWebViewController_12( this, Invocation.getter(#controller), ), - returnValueForMissingStub: _FakePlatformWebViewController_11( + returnValueForMissingStub: _FakePlatformWebViewController_12( this, Invocation.getter(#controller), ), @@ -943,13 +1009,186 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock returnValueForMissingStub: _i4.TextDirection.rtl, ) as _i4.TextDirection); @override - Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>> get gestureRecognizers => + Set<_i12.Factory<_i13.OneSequenceGestureRecognizer>> get gestureRecognizers => (super.noSuchMethod( Invocation.getter(#gestureRecognizers), - returnValue: <_i10.Factory<_i11.OneSequenceGestureRecognizer>>{}, + returnValue: <_i12.Factory<_i13.OneSequenceGestureRecognizer>>{}, returnValueForMissingStub: < - _i10.Factory<_i11.OneSequenceGestureRecognizer>>{}, - ) as Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>>); + _i12.Factory<_i13.OneSequenceGestureRecognizer>>{}, + ) as Set<_i12.Factory<_i13.OneSequenceGestureRecognizer>>); +} + +/// A class which mocks [ExpensiveAndroidViewController]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockExpensiveAndroidViewController extends _i1.Mock + implements _i7.ExpensiveAndroidViewController { + @override + bool get requiresViewComposition => (super.noSuchMethod( + Invocation.getter(#requiresViewComposition), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + int get viewId => (super.noSuchMethod( + Invocation.getter(#viewId), + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); + @override + bool get awaitingCreation => (super.noSuchMethod( + Invocation.getter(#awaitingCreation), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + _i7.PointTransformer get pointTransformer => (super.noSuchMethod( + Invocation.getter(#pointTransformer), + returnValue: (_i4.Offset position) => _FakeOffset_6( + this, + Invocation.getter(#pointTransformer), + ), + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_6( + this, + Invocation.getter(#pointTransformer), + ), + ) as _i7.PointTransformer); + @override + set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override + bool get isCreated => (super.noSuchMethod( + Invocation.getter(#isCreated), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + List<_i7.PlatformViewCreatedCallback> get createdCallbacks => + (super.noSuchMethod( + Invocation.getter(#createdCallbacks), + returnValue: <_i7.PlatformViewCreatedCallback>[], + returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], + ) as List<_i7.PlatformViewCreatedCallback>); + @override + _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( + Invocation.method( + #setOffset, + [off], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future create({ + _i4.Size? size, + _i4.Offset? position, + }) => + (super.noSuchMethod( + Invocation.method( + #create, + [], + { + #size: size, + #position: position, + }, + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( + Invocation.method( + #setSize, + [size], + ), + returnValue: _i9.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + returnValueForMissingStub: _i9.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + ) as _i9.Future<_i4.Size>); + @override + _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => + (super.noSuchMethod( + Invocation.method( + #sendMotionEvent, + [event], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + void addOnPlatformViewCreatedListener( + _i7.PlatformViewCreatedCallback? listener) => + super.noSuchMethod( + Invocation.method( + #addOnPlatformViewCreatedListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void removeOnPlatformViewCreatedListener( + _i7.PlatformViewCreatedCallback? listener) => + super.noSuchMethod( + Invocation.method( + #removeOnPlatformViewCreatedListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => + (super.noSuchMethod( + Invocation.method( + #setLayoutDirection, + [layoutDirection], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future dispatchPointerEvent(_i14.PointerEvent? event) => + (super.noSuchMethod( + Invocation.method( + #dispatchPointerEvent, + [event], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future clearFocus() => (super.noSuchMethod( + Invocation.method( + #clearFocus, + [], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future dispose() => (super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [FlutterAssetManager]. @@ -958,24 +1197,24 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock class MockFlutterAssetManager extends _i1.Mock implements _i2.FlutterAssetManager { @override - _i7.Future> list(String? path) => (super.noSuchMethod( + _i9.Future> list(String? path) => (super.noSuchMethod( Invocation.method( #list, [path], ), - returnValue: _i7.Future>.value([]), - returnValueForMissingStub: _i7.Future>.value([]), - ) as _i7.Future>); + returnValue: _i9.Future>.value([]), + returnValueForMissingStub: _i9.Future>.value([]), + ) as _i9.Future>); @override - _i7.Future getAssetFilePathByName(String? name) => + _i9.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( Invocation.method( #getAssetFilePathByName, [name], ), - returnValue: _i7.Future.value(''), - returnValueForMissingStub: _i7.Future.value(''), - ) as _i7.Future); + returnValue: _i9.Future.value(''), + returnValueForMissingStub: _i9.Future.value(''), + ) as _i9.Future); } /// A class which mocks [JavaScriptChannel]. @@ -1017,6 +1256,293 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { ) as _i2.JavaScriptChannel); } +/// A class which mocks [PlatformViewsServiceProxy]. +/// +/// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable +class MockPlatformViewsServiceProxy extends _i1.Mock + implements _i6.PlatformViewsServiceProxy { + @override + _i7.ExpensiveAndroidViewController initExpensiveAndroidView({ + required int? id, + required String? viewType, + required _i4.TextDirection? layoutDirection, + dynamic creationParams, + _i7.MessageCodec? creationParamsCodec, + _i4.VoidCallback? onFocus, + }) => + (super.noSuchMethod( + Invocation.method( + #initExpensiveAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + returnValue: _FakeExpensiveAndroidViewController_14( + this, + Invocation.method( + #initExpensiveAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + ), + returnValueForMissingStub: _FakeExpensiveAndroidViewController_14( + this, + Invocation.method( + #initExpensiveAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + ), + ) as _i7.ExpensiveAndroidViewController); + @override + _i7.SurfaceAndroidViewController initSurfaceAndroidView({ + required int? id, + required String? viewType, + required _i4.TextDirection? layoutDirection, + dynamic creationParams, + _i7.MessageCodec? creationParamsCodec, + _i4.VoidCallback? onFocus, + }) => + (super.noSuchMethod( + Invocation.method( + #initSurfaceAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + returnValue: _FakeSurfaceAndroidViewController_15( + this, + Invocation.method( + #initSurfaceAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + ), + returnValueForMissingStub: _FakeSurfaceAndroidViewController_15( + this, + Invocation.method( + #initSurfaceAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), + ), + ) as _i7.SurfaceAndroidViewController); +} + +/// A class which mocks [SurfaceAndroidViewController]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockSurfaceAndroidViewController extends _i1.Mock + implements _i7.SurfaceAndroidViewController { + @override + bool get requiresViewComposition => (super.noSuchMethod( + Invocation.getter(#requiresViewComposition), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + int get viewId => (super.noSuchMethod( + Invocation.getter(#viewId), + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); + @override + bool get awaitingCreation => (super.noSuchMethod( + Invocation.getter(#awaitingCreation), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + _i7.PointTransformer get pointTransformer => (super.noSuchMethod( + Invocation.getter(#pointTransformer), + returnValue: (_i4.Offset position) => _FakeOffset_6( + this, + Invocation.getter(#pointTransformer), + ), + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_6( + this, + Invocation.getter(#pointTransformer), + ), + ) as _i7.PointTransformer); + @override + set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override + bool get isCreated => (super.noSuchMethod( + Invocation.getter(#isCreated), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + @override + List<_i7.PlatformViewCreatedCallback> get createdCallbacks => + (super.noSuchMethod( + Invocation.getter(#createdCallbacks), + returnValue: <_i7.PlatformViewCreatedCallback>[], + returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], + ) as List<_i7.PlatformViewCreatedCallback>); + @override + _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( + Invocation.method( + #setOffset, + [off], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future create({ + _i4.Size? size, + _i4.Offset? position, + }) => + (super.noSuchMethod( + Invocation.method( + #create, + [], + { + #size: size, + #position: position, + }, + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( + Invocation.method( + #setSize, + [size], + ), + returnValue: _i9.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + returnValueForMissingStub: _i9.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + ) as _i9.Future<_i4.Size>); + @override + _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => + (super.noSuchMethod( + Invocation.method( + #sendMotionEvent, + [event], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + void addOnPlatformViewCreatedListener( + _i7.PlatformViewCreatedCallback? listener) => + super.noSuchMethod( + Invocation.method( + #addOnPlatformViewCreatedListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void removeOnPlatformViewCreatedListener( + _i7.PlatformViewCreatedCallback? listener) => + super.noSuchMethod( + Invocation.method( + #removeOnPlatformViewCreatedListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => + (super.noSuchMethod( + Invocation.method( + #setLayoutDirection, + [layoutDirection], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future dispatchPointerEvent(_i14.PointerEvent? event) => + (super.noSuchMethod( + Invocation.method( + #dispatchPointerEvent, + [event], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future clearFocus() => (super.noSuchMethod( + Invocation.method( + #clearFocus, + [], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); + @override + _i9.Future dispose() => (super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); +} + /// A class which mocks [WebChromeClient]. /// /// See the documentation for Mockito's code generation for more information. @@ -1049,132 +1575,132 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { /// See the documentation for Mockito's code generation for more information. class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override - _i7.Future setDomStorageEnabled(bool? flag) => (super.noSuchMethod( + _i9.Future setDomStorageEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( #setDomStorageEnabled, [flag], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => + _i9.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( Invocation.method( #setJavaScriptCanOpenWindowsAutomatically, [flag], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setSupportMultipleWindows(bool? support) => + _i9.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( Invocation.method( #setSupportMultipleWindows, [support], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( + _i9.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( #setJavaScriptEnabled, [flag], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setUserAgentString(String? userAgentString) => + _i9.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( Invocation.method( #setUserAgentString, [userAgentString], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setMediaPlaybackRequiresUserGesture(bool? require) => + _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( Invocation.method( #setMediaPlaybackRequiresUserGesture, [require], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setSupportZoom(bool? support) => (super.noSuchMethod( + _i9.Future setSupportZoom(bool? support) => (super.noSuchMethod( Invocation.method( #setSupportZoom, [support], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setLoadWithOverviewMode(bool? overview) => + _i9.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( Invocation.method( #setLoadWithOverviewMode, [overview], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( + _i9.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( Invocation.method( #setUseWideViewPort, [use], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( + _i9.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( #setDisplayZoomControls, [enabled], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( + _i9.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( #setBuiltInZoomControls, [enabled], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( + _i9.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( Invocation.method( #setAllowFileAccess, [enabled], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i2.WebSettings copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWebSettings_12( + returnValue: _FakeWebSettings_16( this, Invocation.method( #copy, [], ), ), - returnValueForMissingStub: _FakeWebSettings_12( + returnValueForMissingStub: _FakeWebSettings_16( this, Invocation.method( #copy, @@ -1197,17 +1723,17 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), - returnValue: _FakeWebSettings_12( + returnValue: _FakeWebSettings_16( this, Invocation.getter(#settings), ), - returnValueForMissingStub: _FakeWebSettings_12( + returnValueForMissingStub: _FakeWebSettings_16( this, Invocation.getter(#settings), ), ) as _i2.WebSettings); @override - _i7.Future loadData({ + _i9.Future loadData({ required String? data, String? mimeType, String? encoding, @@ -1222,11 +1748,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { #encoding: encoding, }, ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future loadDataWithBaseUrl({ + _i9.Future loadDataWithBaseUrl({ String? baseUrl, required String? data, String? mimeType, @@ -1245,11 +1771,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { #historyUrl: historyUrl, }, ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future loadUrl( + _i9.Future loadUrl( String? url, Map? headers, ) => @@ -1261,13 +1787,13 @@ class MockWebView extends _i1.Mock implements _i2.WebView { headers, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future postUrl( + _i9.Future postUrl( String? url, - _i12.Uint8List? data, + _i15.Uint8List? data, ) => (super.noSuchMethod( Invocation.method( @@ -1277,93 +1803,93 @@ class MockWebView extends _i1.Mock implements _i2.WebView { data, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future getUrl() => (super.noSuchMethod( + _i9.Future getUrl() => (super.noSuchMethod( Invocation.method( #getUrl, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future canGoBack() => (super.noSuchMethod( + _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( #canGoBack, [], ), - returnValue: _i7.Future.value(false), - returnValueForMissingStub: _i7.Future.value(false), - ) as _i7.Future); + returnValue: _i9.Future.value(false), + returnValueForMissingStub: _i9.Future.value(false), + ) as _i9.Future); @override - _i7.Future canGoForward() => (super.noSuchMethod( + _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( #canGoForward, [], ), - returnValue: _i7.Future.value(false), - returnValueForMissingStub: _i7.Future.value(false), - ) as _i7.Future); + returnValue: _i9.Future.value(false), + returnValueForMissingStub: _i9.Future.value(false), + ) as _i9.Future); @override - _i7.Future goBack() => (super.noSuchMethod( + _i9.Future goBack() => (super.noSuchMethod( Invocation.method( #goBack, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future goForward() => (super.noSuchMethod( + _i9.Future goForward() => (super.noSuchMethod( Invocation.method( #goForward, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future reload() => (super.noSuchMethod( + _i9.Future reload() => (super.noSuchMethod( Invocation.method( #reload, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( + _i9.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( #clearCache, [includeDiskFiles], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future evaluateJavascript(String? javascriptString) => + _i9.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( Invocation.method( #evaluateJavascript, [javascriptString], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future getTitle() => (super.noSuchMethod( + _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( #getTitle, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future scrollTo( + _i9.Future scrollTo( int? x, int? y, ) => @@ -1375,11 +1901,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { y, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future scrollBy( + _i9.Future scrollBy( int? x, int? y, ) => @@ -1391,109 +1917,109 @@ class MockWebView extends _i1.Mock implements _i2.WebView { y, ], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future getScrollX() => (super.noSuchMethod( + _i9.Future getScrollX() => (super.noSuchMethod( Invocation.method( #getScrollX, [], ), - returnValue: _i7.Future.value(0), - returnValueForMissingStub: _i7.Future.value(0), - ) as _i7.Future); + returnValue: _i9.Future.value(0), + returnValueForMissingStub: _i9.Future.value(0), + ) as _i9.Future); @override - _i7.Future getScrollY() => (super.noSuchMethod( + _i9.Future getScrollY() => (super.noSuchMethod( Invocation.method( #getScrollY, [], ), - returnValue: _i7.Future.value(0), - returnValueForMissingStub: _i7.Future.value(0), - ) as _i7.Future); + returnValue: _i9.Future.value(0), + returnValueForMissingStub: _i9.Future.value(0), + ) as _i9.Future); @override - _i7.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( + _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( #getScrollPosition, [], ), - returnValue: _i7.Future<_i4.Offset>.value(_FakeOffset_6( + returnValue: _i9.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, [], ), )), - returnValueForMissingStub: _i7.Future<_i4.Offset>.value(_FakeOffset_6( + returnValueForMissingStub: _i9.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, [], ), )), - ) as _i7.Future<_i4.Offset>); + ) as _i9.Future<_i4.Offset>); @override - _i7.Future setWebViewClient(_i2.WebViewClient? webViewClient) => + _i9.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( Invocation.method( #setWebViewClient, [webViewClient], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future addJavaScriptChannel( + _i9.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( Invocation.method( #addJavaScriptChannel, [javaScriptChannel], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future removeJavaScriptChannel( + _i9.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( Invocation.method( #removeJavaScriptChannel, [javaScriptChannel], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setDownloadListener(_i2.DownloadListener? listener) => + _i9.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( Invocation.method( #setDownloadListener, [listener], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setWebChromeClient(_i2.WebChromeClient? client) => + _i9.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( Invocation.method( #setWebChromeClient, [client], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i7.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( + _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( #setBackgroundColor, [color], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -1522,16 +2048,16 @@ class MockWebView extends _i1.Mock implements _i2.WebView { /// See the documentation for Mockito's code generation for more information. class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override - _i7.Future setSynchronousReturnValueForShouldOverrideUrlLoading( + _i9.Future setSynchronousReturnValueForShouldOverrideUrlLoading( bool? value) => (super.noSuchMethod( Invocation.method( #setSynchronousReturnValueForShouldOverrideUrlLoading, [value], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( @@ -1560,28 +2086,28 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { /// See the documentation for Mockito's code generation for more information. class MockWebStorage extends _i1.Mock implements _i2.WebStorage { @override - _i7.Future deleteAllData() => (super.noSuchMethod( + _i9.Future deleteAllData() => (super.noSuchMethod( Invocation.method( #deleteAllData, [], ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i2.WebStorage copy() => (super.noSuchMethod( Invocation.method( #copy, [], ), - returnValue: _FakeWebStorage_13( + returnValue: _FakeWebStorage_17( this, Invocation.method( #copy, [], ), ), - returnValueForMissingStub: _FakeWebStorage_13( + returnValueForMissingStub: _FakeWebStorage_17( this, Invocation.method( #copy, From 2dd85ec81d06707e9e99b388db36f3b725a0a9bf Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 21 Dec 2022 18:35:26 -0500 Subject: [PATCH 3/3] [webview_flutter_android] Fixes bug where a `AndroidNavigationDelegate` was required to load a request (#6872) * fix bug * comment * another test * fix spelling --- .../webview_flutter_android/CHANGELOG.md | 4 +++ .../WebChromeClientHostApiImpl.java | 21 ++++++++---- .../webviewflutter/WebViewHostApiImpl.java | 34 +++++++++++-------- .../plugins/webviewflutter/WebViewTest.java | 19 +++++++++++ .../webview_flutter_android/pubspec.yaml | 2 +- 5 files changed, 57 insertions(+), 23 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index fe285b8f5867..b5502ecd2577 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.1 + +* Fixes bug where a `AndroidNavigationDelegate` was required to load a request. + ## 3.1.0 * Adds support for selecting Hybrid Composition on versions 23+. Please use diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 7b5241ed4d33..3fa4a2f9c298 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -29,9 +29,8 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { /** * Implementation of {@link WebChromeClient} that passes arguments of callback methods to Dart. */ - public static class WebChromeClientImpl extends WebChromeClient { + public static class WebChromeClientImpl extends SecureWebChromeClient { private final WebChromeClientFlutterApiImpl flutterApi; - @Nullable private WebViewClient webViewClient; /** * Creates a {@link WebChromeClient} that passes arguments of callbacks methods to Dart. @@ -42,6 +41,19 @@ public WebChromeClientImpl(@NonNull WebChromeClientFlutterApiImpl flutterApi) { this.flutterApi = flutterApi; } + @Override + public void onProgressChanged(WebView view, int progress) { + flutterApi.onProgressChanged(this, view, (long) progress, reply -> {}); + } + } + + /** + * Implementation of {@link WebChromeClient} that only allows secure urls when opening a new + * window. + */ + public static class SecureWebChromeClient extends WebChromeClient { + @Nullable private WebViewClient webViewClient; + @Override public boolean onCreateWindow( final WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) { @@ -105,11 +117,6 @@ public boolean shouldOverrideUrlLoading(WebView windowWebView, String url) { return true; } - @Override - public void onProgressChanged(WebView view, int progress) { - flutterApi.onProgressChanged(this, view, (long) progress, reply -> {}); - } - /** * Set the {@link WebViewClient} that calls to {@link WebChromeClient#onCreateWindow} are passed * to. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java index 2fd990535b29..0a044cc5ab7e 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java @@ -17,7 +17,6 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.platform.PlatformView; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.WebViewHostApi; -import io.flutter.plugins.webviewflutter.WebChromeClientHostApiImpl.WebChromeClientImpl; import java.util.Map; import java.util.Objects; @@ -80,7 +79,7 @@ public void setWebContentsDebuggingEnabled(boolean enabled) { /** Implementation of {@link WebView} that can be used as a Flutter {@link PlatformView}s. */ public static class WebViewPlatformView extends WebView implements PlatformView { private WebViewClient currentWebViewClient; - private WebChromeClientImpl currentWebChromeClient; + private WebChromeClientHostApiImpl.SecureWebChromeClient currentWebChromeClient; /** * Creates a {@link WebViewPlatformView}. @@ -91,9 +90,7 @@ public WebViewPlatformView( Context context, BinaryMessenger binaryMessenger, InstanceManager instanceManager) { super(context); currentWebViewClient = new WebViewClient(); - currentWebChromeClient = - new WebChromeClientImpl( - new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager)); + currentWebChromeClient = new WebChromeClientHostApiImpl.SecureWebChromeClient(); setWebViewClient(currentWebViewClient); setWebChromeClient(currentWebChromeClient); @@ -119,12 +116,21 @@ public void setWebViewClient(WebViewClient webViewClient) { @Override public void setWebChromeClient(WebChromeClient client) { super.setWebChromeClient(client); - if (!(client instanceof WebChromeClientImpl)) { - throw new AssertionError("Client must be a WebChromeClientImpl."); + if (!(client instanceof WebChromeClientHostApiImpl.SecureWebChromeClient)) { + throw new AssertionError("Client must be a SecureWebChromeClient."); } - currentWebChromeClient = (WebChromeClientImpl) client; + currentWebChromeClient = (WebChromeClientHostApiImpl.SecureWebChromeClient) client; currentWebChromeClient.setWebViewClient(currentWebViewClient); } + + // When running unit tests, the parent `WebView` class is replaced by a stub that returns null + // for every method. This is overridden so that this returns the current WebChromeClient during + // unit tests. This should only remain overridden as long as `setWebChromeClient` is overridden. + @Nullable + @Override + public WebChromeClient getWebChromeClient() { + return currentWebChromeClient; + } } /** @@ -135,7 +141,7 @@ public void setWebChromeClient(WebChromeClient client) { public static class InputAwareWebViewPlatformView extends InputAwareWebView implements PlatformView { private WebViewClient currentWebViewClient; - private WebChromeClientImpl currentWebChromeClient; + private WebChromeClientHostApiImpl.SecureWebChromeClient currentWebChromeClient; /** * Creates a {@link InputAwareWebViewPlatformView}. @@ -149,9 +155,7 @@ public InputAwareWebViewPlatformView( View containerView) { super(context, containerView); currentWebViewClient = new WebViewClient(); - currentWebChromeClient = - new WebChromeClientImpl( - new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager)); + currentWebChromeClient = new WebChromeClientHostApiImpl.SecureWebChromeClient(); setWebViewClient(currentWebViewClient); setWebChromeClient(currentWebChromeClient); @@ -198,10 +202,10 @@ public void setWebViewClient(WebViewClient webViewClient) { @Override public void setWebChromeClient(WebChromeClient client) { super.setWebChromeClient(client); - if (!(client instanceof WebChromeClientImpl)) { - throw new AssertionError("Client must be a WebChromeClientImpl."); + if (!(client instanceof WebChromeClientHostApiImpl.SecureWebChromeClient)) { + throw new AssertionError("Client must be a SecureWebChromeClient."); } - currentWebChromeClient = (WebChromeClientImpl) client; + currentWebChromeClient = (WebChromeClientHostApiImpl.SecureWebChromeClient) client; currentWebChromeClient.setWebViewClient(currentWebViewClient); } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java index ecaab779c16a..c49d6c5d1142 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java @@ -5,6 +5,8 @@ package io.flutter.plugins.webviewflutter; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -18,6 +20,7 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.WebViewHostApiImpl.WebViewPlatformView; import java.util.HashMap; +import java.util.Objects; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -262,4 +265,20 @@ public void setWebChromeClient() { testHostApiImpl.setWebChromeClient(0L, 1L); verify(mockWebView).setWebChromeClient(mockWebChromeClient); } + + @Test + public void defaultWebChromeClientIsSecureWebChromeClient() { + final WebViewPlatformView webView = new WebViewPlatformView(mockContext, null, null); + assertTrue( + webView.getWebChromeClient() instanceof WebChromeClientHostApiImpl.SecureWebChromeClient); + assertFalse( + webView.getWebChromeClient() instanceof WebChromeClientHostApiImpl.WebChromeClientImpl); + } + + @Test + public void defaultWebChromeClientDoesNotAttemptToCommunicateWithDart() { + final WebViewPlatformView webView = new WebViewPlatformView(mockContext, null, null); + // This shouldn't throw an Exception. + Objects.requireNonNull(webView.getWebChromeClient()).onProgressChanged(webView, 0); + } } diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index cf6939ae1c55..72bc2e43414a 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/plugins/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.1.0 +version: 3.1.1 environment: sdk: ">=2.17.0 <3.0.0"