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, ), );