From 7dde204047593038465096b401369b3f1e979f7c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 1 May 2022 18:24:08 -0700 Subject: [PATCH 01/23] bunch of work for other apis --- .../webview_flutter_wkwebview/go.sh | 5 + .../ios/Classes/FWFDataConverters.h | 58 + .../ios/Classes/FWFDataConverters.m | 121 ++ .../ios/Classes/FWFGeneratedWebKitApis.h | 299 +--- .../ios/Classes/FWFGeneratedWebKitApis.m | 1332 +++++++-------- .../ios/Classes/FWFHTTPCookieStoreHostApi.h | 22 + .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 53 + .../ios/Classes/FWFPreferencesHostApi.h | 22 + .../ios/Classes/FWFPreferencesHostApi.m | 44 + .../Classes/FWFWebViewConfigurationHostApi.h | 22 + .../Classes/FWFWebViewConfigurationHostApi.m | 74 + .../ios/Classes/FWFWebsiteDataStoreHostApi.h | 22 + .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 40 + .../ios/Classes/webview-umbrella.h | 4 + .../lib/src/common/web_kit.pigeon.dart | 775 ++++----- .../lib/src/foundation/foundation.dart | 9 + .../src/foundation/foundation.simple_ast.json | 928 ++++++++++ .../lib/src/ui_kit/ui_kit.dart | 3 + .../lib/src/ui_kit/ui_kit.simple_ast.json | 403 +++++ .../lib/src/web_kit/data_output.h | 36 + .../lib/src/web_kit/data_output.m | 113 ++ .../lib/src/web_kit/data_template.h | 10 + .../lib/src/web_kit/data_template.m | 12 + .../lib/src/web_kit/output.h | 212 +++ .../lib/src/web_kit/output.m | 626 +++++++ .../lib/src/web_kit/output_test.m | 436 +++++ .../lib/src/web_kit/template.h | 32 + .../lib/src/web_kit/template.m | 88 + .../lib/src/web_kit/template_test.m | 54 + .../lib/src/web_kit/web_kit.dart | 137 +- .../lib/src/web_kit/web_kit.simple_ast.json | 1492 +++++++++++++++++ .../lib/src/web_kit/web_kit_api_impls.dart | 46 +- .../lib/src/web_kit_cookie_manager.dart | 2 +- .../lib/src/web_kit_webview_widget.dart | 10 +- .../pigeons/web_kit.dart | 15 +- .../webview_flutter_wkwebview/pubspec.yaml | 6 + .../test/src/common/test_web_kit.pigeon.dart | 840 ++++------ .../src/foundation/foundation_test.mocks.dart | 2 +- .../test/src/ui_kit/ui_kit_test.mocks.dart | 2 +- .../test/src/web_kit/web_kit_test.dart | 10 +- .../test/src/web_kit/web_kit_test.mocks.dart | 29 +- .../test/src/web_kit_cookie_manager_test.dart | 4 +- .../web_kit_cookie_manager_test.mocks.dart | 2 +- .../test/src/web_kit_webview_widget_test.dart | 10 +- .../web_kit_webview_widget_test.mocks.dart | 2 +- 45 files changed, 6393 insertions(+), 2071 deletions(-) create mode 100755 packages/webview_flutter/webview_flutter_wkwebview/go.sh create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json diff --git a/packages/webview_flutter/webview_flutter_wkwebview/go.sh b/packages/webview_flutter/webview_flutter_wkwebview/go.sh new file mode 100755 index 000000000000..652603e43c42 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/go.sh @@ -0,0 +1,5 @@ +flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/web_kit/web_kit.simple_ast.json --token-opener /*- lib/src/web_kit/output.h +flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m +flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h +flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m 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 e9dbf2d9efa7..eaf656205b2a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -4,8 +4,11 @@ #import "FWFGeneratedWebKitApis.h" +#import + NS_ASSUME_NONNULL_BEGIN +// TODO: Some should take an NSError /** * Converts an FWFNSUrlRequestData to an NSURLRequest. * @@ -16,4 +19,59 @@ NS_ASSUME_NONNULL_BEGIN extern NSURLRequest* _Nullable FWFNSURLRequestFromRequestData( FWFNSUrlRequestData* data); +/** + * Converts an FWFNSHttpCookieData to an NSHTTPCookie. + * + * @param data The data object containing information to create an NSHTTPCookie. + * + * @return An NSHTTPCookie or nil if data could not be converted. + */ +extern NSHTTPCookie* _Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData* data); + +/** + * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. + * + * @param data The data object containing information to create an NSKeyValueObservingOptions. + * + * @return An NSKeyValueObservingOptions or -1 if data could not be converted. + */ +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); + +/** + * Converts an FWFNSHTTPCookiePropertyKeyEnumData to an NSHTTPCookiePropertyKey. + * + * @param data The data object containing information to create an NSHTTPCookiePropertyKey. + * + * @return An NSHttpCookiePropertyKey or nil if data could not be converted. + */ +extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); + +/** + * Converts an FWFWKUserScriptInjectionTimeEnumData to a WKUserScriptInjectionTime. + * + * @param data The data object containing information to create a WKUserScriptInjectionTime. + * + * @return An WKUserScriptInjectionTime or -1 if data could not be converted. + */ +extern WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData(FWFWKUserScriptInjectionTimeEnumData *data); + +/** + * Converts an FWFWKAudiovisualMediaTypeEnumData to an WKAudiovisualMediaTypes. + * + * @param data The data object containing information to create an WKAudiovisualMediaTypes. + * + * @return An WKAudiovisualMediaType or -1 if data could not be converted. + */ +API_AVAILABLE(ios(10.0)) +extern WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(FWFWKAudiovisualMediaTypeEnumData *data); + +/** + * Converts an FWFWKWebsiteDataTypeEnumData to a WKWebsiteDataType. + * + * @param data The data object containing information to create a WKWebsiteDataType. + * + * @return An WKWebsiteDataType or nil if data could not be converted. + */ +extern NSString *_Nullable FWFWKWebsiteDataTypeFromEnumData(FWFWKWebsiteDataTypeEnumData *data); + 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 1945bc3354f3..8402a067e7eb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -23,3 +23,124 @@ return request; } + +extern NSHTTPCookie* _Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData* data) { + NSMutableDictionary *properties = [NSMutableDictionary dictionary]; + for (FWFNSHttpCookiePropertyKeyEnumData* key in data.properties.allKeys) { + NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(key); + if (!cookieKey) { + return nil; + } + [properties setObject:data.properties[key] forKey:cookieKey]; + } + return [NSHTTPCookie cookieWithProperties:properties]; +} + + +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { + switch(data.value) { + case FWFNSKeyValueObservingOptionsEnumNewValue: + return NSKeyValueObservingOptionNew; + case FWFNSKeyValueObservingOptionsEnumOldValue: + return NSKeyValueObservingOptionOld; + case FWFNSKeyValueObservingOptionsEnumInitialValue: + return NSKeyValueObservingOptionInitial; + case FWFNSKeyValueObservingOptionsEnumPriorNotification: + return NSKeyValueObservingOptionPrior; + } + + return -1; +} + +NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { + switch(data.value) { + case FWFNSHttpCookiePropertyKeyEnumComment: + return NSHTTPCookieComment; + case FWFNSHttpCookiePropertyKeyEnumCommentUrl: + return NSHTTPCookieCommentURL; + case FWFNSHttpCookiePropertyKeyEnumDiscard: + return NSHTTPCookieDiscard; + case FWFNSHttpCookiePropertyKeyEnumDomain: + return NSHTTPCookieDomain; + case FWFNSHttpCookiePropertyKeyEnumExpires: + return NSHTTPCookieExpires; + case FWFNSHttpCookiePropertyKeyEnumMaximumAge: + return NSHTTPCookieMaximumAge; + case FWFNSHttpCookiePropertyKeyEnumName: + return NSHTTPCookieName; + case FWFNSHttpCookiePropertyKeyEnumOriginUrl: + return NSHTTPCookieOriginURL; + case FWFNSHttpCookiePropertyKeyEnumPath: + return NSHTTPCookiePath; + case FWFNSHttpCookiePropertyKeyEnumPort: + return NSHTTPCookiePort; + case FWFNSHttpCookiePropertyKeyEnumSameSitePolicy: + if (@available(iOS 13.0, *)) { + return NSHTTPCookieSameSitePolicy; + } else { + NSLog(@"NSHTTPCookieSameSitePolicy is only supported on iOS 13+."); + return nil; + } + case FWFNSHttpCookiePropertyKeyEnumSecure: + return NSHTTPCookieSecure; + case FWFNSHttpCookiePropertyKeyEnumValue: + return NSHTTPCookieValue; + case FWFNSHttpCookiePropertyKeyEnumVersion: + return NSHTTPCookieVersion; + } + + return nil; +} + + +WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData(FWFWKUserScriptInjectionTimeEnumData *data) { + switch(data.value) { + case FWFWKUserScriptInjectionTimeEnumAtDocumentStart: + return WKUserScriptInjectionTimeAtDocumentStart; + case FWFWKUserScriptInjectionTimeEnumAtDocumentEnd: + return WKUserScriptInjectionTimeAtDocumentEnd; + } + + return -1; +} + +API_AVAILABLE(ios(10.0)) +WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(FWFWKAudiovisualMediaTypeEnumData *data) { + switch(data.value) { + case FWFWKAudiovisualMediaTypeEnumNone: + return WKAudiovisualMediaTypeNone; + case FWFWKAudiovisualMediaTypeEnumAudio: + return WKAudiovisualMediaTypeAudio; + case FWFWKAudiovisualMediaTypeEnumVideo: + return WKAudiovisualMediaTypeVideo; + case FWFWKAudiovisualMediaTypeEnumAll: + return WKAudiovisualMediaTypeAll; + } + + + return -1; +} + +NSString *_Nullable FWFWKWebsiteDataTypeFromEnumData(FWFWKWebsiteDataTypeEnumData *data) { + switch(data.value) { + case FWFWKWebsiteDataTypeEnumCookies: + return WKWebsiteDataTypeCookies; + case FWFWKWebsiteDataTypeEnumMemoryCache: + return WKWebsiteDataTypeMemoryCache; + case FWFWKWebsiteDataTypeEnumDiskCache: + return WKWebsiteDataTypeDiskCache; + case FWFWKWebsiteDataTypeEnumOfflineWebApplicationCache: + return WKWebsiteDataTypeOfflineWebApplicationCache; + case FWFWKWebsiteDataTypeEnumLocalStorage: + return WKWebsiteDataTypeLocalStorage; + case FWFWKWebsiteDataTypeEnumSessionStorage: + return WKWebsiteDataTypeSessionStorage; + case FWFWKWebsiteDataTypeEnumWebSQLDatabases: + return WKWebsiteDataTypeWebSQLDatabases; + case FWFWKWebsiteDataTypeEnumIndexedDBDatabases: + return WKWebsiteDataTypeIndexedDBDatabases; + } + + return nil; +} + 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 5306b300fc03..c9243fc42a01 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -45,15 +45,15 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumAll = 3, }; -typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypesEnum) { - FWFWKWebsiteDataTypesEnumCookies = 0, - FWFWKWebsiteDataTypesEnumMemoryCache = 1, - FWFWKWebsiteDataTypesEnumDiskCache = 2, - FWFWKWebsiteDataTypesEnumOfflineWebApplicationCache = 3, - FWFWKWebsiteDataTypesEnumLocalStroage = 4, - FWFWKWebsiteDataTypesEnumSessionStorage = 5, - FWFWKWebsiteDataTypesEnumSqlDatabases = 6, - FWFWKWebsiteDataTypesEnumIndexedDBDatabases = 7, +typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { + FWFWKWebsiteDataTypeEnumCookies = 0, + FWFWKWebsiteDataTypeEnumMemoryCache = 1, + FWFWKWebsiteDataTypeEnumDiskCache = 2, + FWFWKWebsiteDataTypeEnumOfflineWebApplicationCache = 3, + FWFWKWebsiteDataTypeEnumLocalStorage = 4, + FWFWKWebsiteDataTypeEnumSessionStorage = 5, + FWFWKWebsiteDataTypeEnumWebSQLDatabases = 6, + FWFWKWebsiteDataTypeEnumIndexedDBDatabases = 7, }; typedef NS_ENUM(NSUInteger, FWFWKNavigationActionPolicyEnum) { @@ -81,7 +81,7 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @class FWFNSKeyValueObservingOptionsEnumData; @class FWFWKUserScriptInjectionTimeEnumData; @class FWFWKAudiovisualMediaTypeEnumData; -@class FWFWKWebsiteDataTypesEnumData; +@class FWFWKWebsiteDataTypeEnumData; @class FWFNSHttpCookiePropertyKeyEnumData; @class FWFNSUrlRequestData; @class FWFWKUserScriptData; @@ -102,9 +102,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @property(nonatomic, assign) FWFWKAudiovisualMediaTypeEnum value; @end -@interface FWFWKWebsiteDataTypesEnumData : NSObject -+ (instancetype)makeWithValue:(FWFWKWebsiteDataTypesEnum)value; -@property(nonatomic, assign) FWFWKWebsiteDataTypesEnum value; +@interface FWFWKWebsiteDataTypeEnumData : NSObject ++ (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value; +@property(nonatomic, assign) FWFWKWebsiteDataTypeEnum value; @end @interface FWFNSHttpCookiePropertyKeyEnumData : NSObject @@ -116,170 +116,104 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString *url; -@property(nonatomic, copy, nullable) NSString *httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString * url; +@property(nonatomic, copy, nullable) NSString * httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; +@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString *source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString * source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; +@property(nonatomic, strong) NSNumber * isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProperties: - (NSDictionary *)properties; -@property(nonatomic, strong) - NSDictionary *properties; ++ (instancetype)makeWithProperties:(NSDictionary *)properties; +@property(nonatomic, strong) NSDictionary * properties; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createDataStoreFromConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId - ofTypes:(NSArray *)dataTypes - secondsModifiedSinceEpoch:(NSNumber *)secondsModifiedSinceEpoch - completion:(void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion; +- (void)createDataStoreFromConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes secondsModifiedSinceEpoch:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId - toValue:(nullable NSNumber *)value - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId - isOpaque:(NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId - isAlowed:(NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId - forTypes: - (NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - error: - (FlutterError *_Nullable *_Nonnull) - error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAlowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - handlerIdentifier:(NSNumber *)handlerInstanceid - ofName:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - name:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId - userScript:(FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfiguration:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId - isEnabled:(NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -288,126 +222,71 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId - functionIdentifier:(nullable NSNumber *)functionInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - URL:(nullable NSString *)url - completion:(void (^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - options: - (NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId - completion:(void (^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier: - (nullable NSNumber *)navigationDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId - request:(FWFNSUrlRequestData *)request - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId - HTMLString:(NSString *)string - baseURL:(nullable NSString *)baseUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId - fileURL:(NSString *)url - readAccessURL:(NSString *)readAccessUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId - assetKey:(NSString *)key - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId - isAllowed:(NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId - javaScriptString:(NSString *)javaScriptString - completion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -416,22 +295,16 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId - dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId - cookie:(FWFNSHttpCookieData *)cookie - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 070b3c5cc033..dc59abd2b899 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,25 +14,26 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; + @"code": (error.code ? error.code : [NSNull null]), + @"message": (error.message ? error.message : [NSNull null]), + @"details": (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; + @"result": (result ? result : [NSNull null]), + @"error": errorDict, + }; } -static id GetNullableObject(NSDictionary *dict, id key) { +static id GetNullableObject(NSDictionary* dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } + @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -45,8 +46,8 @@ @interface FWFWKAudiovisualMediaTypeEnumData () + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end -@interface FWFWKWebsiteDataTypesEnumData () -+ (FWFWKWebsiteDataTypesEnumData *)fromMap:(NSDictionary *)dict; +@interface FWFWKWebsiteDataTypeEnumData () ++ (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSHttpCookiePropertyKeyEnumData () @@ -68,14 +69,12 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -86,14 +85,12 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -104,14 +101,12 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -120,14 +115,14 @@ - (NSDictionary *)toMap { } @end -@implementation FWFWKWebsiteDataTypesEnumData -+ (instancetype)makeWithValue:(FWFWKWebsiteDataTypesEnum)value { - FWFWKWebsiteDataTypesEnumData *pigeonResult = [[FWFWKWebsiteDataTypesEnumData alloc] init]; +@implementation FWFWKWebsiteDataTypeEnumData ++ (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { + FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } -+ (FWFWKWebsiteDataTypesEnumData *)fromMap:(NSDictionary *)dict { - FWFWKWebsiteDataTypesEnumData *pigeonResult = [[FWFWKWebsiteDataTypesEnumData alloc] init]; ++ (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict { + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -138,14 +133,12 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -156,10 +149,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -177,22 +170,15 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", - (self.httpMethod ? self.httpMethod : [NSNull null]), - @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), - @"httpBody", - (self.allHttpHeaderFields ? self.allHttpHeaderFields - : [NSNull null]), - @"allHttpHeaderFields", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -202,27 +188,19 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = - [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", - (self.injectionTime ? [self.injectionTime toMap] - : [NSNull null]), - @"injectionTime", - (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), - @"isMainFrameOnly", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData -+ (instancetype)makeWithProperties: - (NSDictionary *)properties { - FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; ++ (instancetype)makeWithProperties:(NSDictionary *)properties { + FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.properties = properties; return pigeonResult; } @@ -233,22 +211,22 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.properties ? self.properties : [NSNull null]), - @"properties", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.properties ? self.properties : [NSNull null]), @"properties", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: - return [FWFWKWebsiteDataTypesEnumData fromMap:[self readValue]]; - - default: + case 128: + return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; + + default: return [super readValueOfType:type]; + } } @end @@ -256,11 +234,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[FWFWKWebsiteDataTypesEnumData class]]) { +- (void)writeValue:(id)value +{ + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -281,53 +261,43 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createDataStoreFromConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:error:" - @")", - api); + NSCAssert([api respondsToSelector:@selector(createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createDataStoreFromConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createDataStoreFromConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDefaultDataStoreWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -335,37 +305,30 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeDataFromDataStoreWithIdentifier: - ofTypes:secondsModifiedSinceEpoch:completion:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:" - @"secondsModifiedSinceEpoch:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:secondsModifiedSinceEpoch:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:secondsModifiedSinceEpoch:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); - NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); + NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId - ofTypes:arg_dataTypes - secondsModifiedSinceEpoch:arg_secondsModifiedSinceEpoch - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes secondsModifiedSinceEpoch:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -395,48 +358,42 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(contentOffsetForViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId - error:&error]; + NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: - toValue:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -445,20 +402,19 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -467,7 +423,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -497,73 +454,63 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId - error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier: - toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -573,34 +520,30 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, [api scrollByForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId - toX:arg_x - y:arg_y - error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -608,13 +551,15 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -622,11 +567,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -647,25 +594,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -673,87 +617,71 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId - isAlowed:arg_allow - error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAlowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." - @"setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: - forTypes:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId - forTypes:arg_types - error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -761,16 +689,18 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -778,14 +708,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -806,109 +739,86 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = - [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addScriptMessageHandlerForControllerWithIdentifier: - handlerIdentifier:ofName:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" - @"ofName:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - handlerIdentifier:arg_handlerInstanceid - ofName:arg_name - error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - name:arg_name - error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -916,46 +826,40 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: - userScript:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId - userScript:arg_userScript - error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllUserScriptsForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -963,7 +867,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -993,62 +898,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = - [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfiguration: - configurationIdentifier:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfiguration:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfiguration:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId - isEnabled:arg_enabled - error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1078,25 +974,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1104,7 +997,8 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1134,25 +1028,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1160,33 +1051,29 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId - functionIdentifier:arg_functionInstanceId - error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1216,15 +1103,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFWKNavigationDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1236,35 +1123,29 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId - webViewIdentifier:(NSNumber *)arg_webViewInstanceId - URL:(nullable NSString *)arg_url - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, - (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, - (arg_url == nil) ? [NSNull null] : arg_url - ] - reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1272,11 +1153,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1297,25 +1180,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = - [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(disposeObjectWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1323,67 +1203,53 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addObserverForObjectWithIdentifier: - observerIdentifier:keyPath:options:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = - GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - options:arg_options - error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: - observerIdentifier:keyPath:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1413,15 +1279,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = - [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFFunctionFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1433,49 +1299,50 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: - return [FWFWKWebsiteDataTypesEnumData fromMap:[self readValue]]; - - default: + + case 135: + return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; + + default: return [super readValueOfType:type]; + } } @end @@ -1483,32 +1350,41 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypesEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1529,101 +1405,85 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_uiDelegateInstanceId - error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_navigationDelegateInstanceId - error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(URLForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1631,44 +1491,39 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: - error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId - error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: - request:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1677,75 +1532,63 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: - HTMLString:baseURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId - HTMLString:arg_string - baseURL:arg_baseUrl - error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId - fileURL:arg_url - readAccessURL:arg_readAccessUrl - error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: - assetKey:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1754,20 +1597,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1775,20 +1617,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1796,20 +1637,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1817,20 +1657,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1838,20 +1677,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(reloadWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1859,20 +1697,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(titleForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1880,85 +1717,71 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId - isAllowed:arg_allow - error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId - userAgent:arg_userAgent - error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId - javaScriptString:arg_javaScriptString - completion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1988,25 +1811,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec()]; + codec:FWFWKUIDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -2014,7 +1834,8 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2022,16 +1843,18 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2039,14 +1862,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2067,59 +1893,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: - dataStoreIdentifier:error:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId - dataStoreIdentifier:arg_websiteDataStoreInstanceId - error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:error:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(setCookieForStoreWithIdentifier:cookie:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - FlutterError *error; - [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie error:&error]; - callback(wrapResult(nil, error)); + [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.h new file mode 100644 index 000000000000..887c9f1b3d8b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for WKHTTPCookieStore. + * + * Handles creating WKHTTPCookieStore that intercommunicate with a paired Dart object. + */ +@interface FWFHTTPCookieStoreHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m new file mode 100644 index 000000000000..7a195845263a --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -0,0 +1,53 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFHTTPCookieStoreHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebsiteDataStoreHostApi.h" + +@interface FWFHTTPCookieStoreHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFHTTPCookieStoreHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSNumber *)instanceId API_AVAILABLE(ios(11.0)){ + return (WKHTTPCookieStore + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + + +- (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + dataStoreIdentifier:(nonnull NSNumber *)websiteDataStoreInstanceId + error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + if (@available(iOS 11.0, *)) { + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:websiteDataStoreInstanceId.longValue]; + [self.instanceManager addInstance:dataStore.httpCookieStore + withIdentifier:instanceId.longValue]; + } else { + // Fallback on earlier versions + } +} + +- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId cookie:(nonnull FWFNSHttpCookieData *)cookie completion:(nonnull void (^)(FlutterError * _Nullable))completion { + NSHTTPCookie *nsCookie = FWFNSHTTPCookieFromCookieData(cookie); + + if (@available(iOS 11.0, *)) { + [[self HTTPCookieStoreForIdentifier:instanceId] setCookie:nsCookie + completionHandler:^{ + completion(nil); + } + ]; + } else { + // Fallback on earlier versions + } +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.h new file mode 100644 index 000000000000..de2d26491a58 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for WKPreferences. + * + * Handles creating WKPreferences that intercommunicate with a paired Dart object. + */ +@interface FWFPreferencesHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m new file mode 100644 index 000000000000..0312d26d49a9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFPreferencesHostApi.h" +#import "FWFWebViewConfigurationHostApi.h" + +@interface FWFPreferencesHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFPreferencesHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (WKPreferences*)preferencesForIdentifier:(NSNumber *)instanceId { + return (WKPreferences*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKPreferences *preferences = [[WKPreferences alloc] init]; + [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; +} + + +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId + isEnabled:(nonnull NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull) error { + [[self preferencesForIdentifier:instanceId] setJavaScriptEnabled:enabled.boolValue]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h new file mode 100644 index 000000000000..4c01d9354107 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for WKWebViewConfiguration. + * + * Handles creating WKWebViewConfiguration that intercommunicate with a paired Dart object. + */ +@interface FWFWebViewConfigurationHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m new file mode 100644 index 000000000000..45a2df72f6aa --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + +@interface FWFWebViewConfigurationHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFWebViewConfigurationHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (WKWebViewConfiguration*)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + return (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *webViewConfiguration = [[WKWebViewConfiguration alloc] init]; + [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId + webViewIdentifier:(nonnull NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { + WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewInstanceId.longValue]; + [self.instanceManager addInstance:webView.configuration withIdentifier:instanceId.longValue]; +} + +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + isAlowed:(nonnull NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull) error { + [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback:allow]; +} + +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + forTypes:(nonnull NSArray *)types + error:(FlutterError *_Nullable *_Nonnull) error { + NSAssert(types.count, @"Types must not be empty."); + + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self webViewConfigurationForIdentifier:instanceId]; + if (@available(iOS 10.0, *)) { + WKAudiovisualMediaTypes typesInt = 0; + for (FWFWKAudiovisualMediaTypeEnumData *data in types) { + typesInt |= FWFWKAudiovisualMediaTypeFromEnumData(data); + } + [configuration setMediaTypesRequiringUserActionForPlayback:typesInt]; + } else { + for (FWFWKAudiovisualMediaTypeEnumData *data in types) { + switch(data.value) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + case FWFWKAudiovisualMediaTypeEnumNone: + configuration.requiresUserActionForMediaPlayback = false; + break; + case FWFWKAudiovisualMediaTypeEnumAudio: + case FWFWKAudiovisualMediaTypeEnumVideo: + case FWFWKAudiovisualMediaTypeEnumAll: + configuration.requiresUserActionForMediaPlayback = true; +#pragma clang diagnostic pop + } + } + } +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.h new file mode 100644 index 000000000000..72f00e032ee4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for WKWebsiteDataStore. + * + * Handles creating WKWebsiteDataStore that intercommunicate with a paired Dart object. + */ +@interface FWFWebsiteDataStoreHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m new file mode 100644 index 000000000000..d5574ddeb43d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -0,0 +1,40 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFWebsiteDataStoreHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + +@interface FWFWebsiteDataStoreHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFWebsiteDataStoreHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { + return (WKWebsiteDataStore*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.websiteDataStore withIdentifier:instanceId.longValue]; +} + + +- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + dataTypes:(nonnull NSArray *)dataTypes + since:(nonnull NSNumber *)since + error:(FlutterError *_Nullable *_Nonnull) error { + return [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes:dataTypes since:since]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index 9a7fd1b5ef3f..b837fbeb77e8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -13,3 +13,7 @@ #import #import #import +#import +#import +#import +#import 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 fa52b43c396e..6d86436d9656 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 @@ -45,14 +45,14 @@ enum WKAudiovisualMediaTypeEnum { all, } -enum WKWebsiteDataTypesEnum { +enum WKWebsiteDataTypeEnum { cookies, memoryCache, diskCache, offlineWebApplicationCache, - localStroage, + localStorage, sessionStorage, - sqlDatabases, + webSQLDatabases, indexedDBDatabases, } @@ -147,12 +147,12 @@ class WKAudiovisualMediaTypeEnumData { } } -class WKWebsiteDataTypesEnumData { - WKWebsiteDataTypesEnumData({ +class WKWebsiteDataTypeEnumData { + WKWebsiteDataTypeEnumData({ this.value, }); - WKWebsiteDataTypesEnum? value; + WKWebsiteDataTypeEnum? value; Object encode() { final Map pigeonMap = {}; @@ -160,11 +160,11 @@ class WKWebsiteDataTypesEnumData { return pigeonMap; } - static WKWebsiteDataTypesEnumData decode(Object message) { + static WKWebsiteDataTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; - return WKWebsiteDataTypesEnumData( + return WKWebsiteDataTypeEnumData( value: pigeonMap['value'] != null - ? WKWebsiteDataTypesEnum.values[pigeonMap['value']! as int] + ? WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int] : null, ); } @@ -221,9 +221,7 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: - (pigeonMap['allHttpHeaderFields'] as Map?)! - .cast(), + allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), ); } } @@ -252,8 +250,7 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode( - pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -276,8 +273,7 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - properties: (pigeonMap['properties'] as Map?)! - .cast(), + properties: (pigeonMap['properties'] as Map?)!.cast(), ); } } @@ -286,22 +282,23 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _WKWebsiteDataStoreHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is WKWebsiteDataTypesEnumData) { + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return WKWebsiteDataTypesEnumData.decode(readValue(buffer)!); - - default: + case 128: + return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); + + default: return super.readValueOfType(type, buffer); + } } } @@ -310,30 +307,24 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -346,9 +337,7 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -357,8 +346,7 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -369,26 +357,18 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes( - int arg_instanceId, - List arg_dataTypes, - double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_dataTypes, - arg_secondsModifiedSinceEpoch - ]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -413,8 +393,7 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -422,8 +401,7 @@ class UIViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -432,8 +410,7 @@ class UIViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -451,18 +428,16 @@ class UIViewHostApi { Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -475,18 +450,16 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -506,29 +479,24 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -541,8 +509,7 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -551,8 +518,7 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -570,19 +536,16 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -593,22 +556,18 @@ class UIScrollViewHostApi { } } - Future setContentOffset( - int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -627,19 +586,20 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -648,18 +608,15 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -668,8 +625,7 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -680,23 +636,18 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -707,22 +658,18 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback( - int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -733,22 +680,18 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, - List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -767,25 +710,27 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -794,31 +739,24 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -829,23 +767,18 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler( - int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_handlerInstanceid, arg_name]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -856,22 +789,18 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler( - int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -884,9 +813,7 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -895,8 +822,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -907,23 +833,18 @@ class WKUserContentControllerHostApi { } } - Future addUserScript( - int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) - as Map?; + await channel.send([arg_instanceId, arg_userScript]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -936,9 +857,7 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -947,8 +866,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -968,30 +886,24 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1002,21 +914,18 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled( - int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1036,18 +945,15 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1056,8 +962,7 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1077,18 +982,15 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1097,8 +999,7 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1109,23 +1010,18 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation( - int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1140,36 +1036,26 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } - abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = - _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation( - int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1184,19 +1070,20 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1205,8 +1092,7 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1214,8 +1100,7 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1224,8 +1109,7 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1236,28 +1120,18 @@ class NSObjectHostApi { } } - Future addObserver( - int arg_instanceId, - int arg_observerInstanceId, - String arg_keyPath, - List arg_options) async { + Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_observerInstanceId, - arg_keyPath, - arg_options - ]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1268,22 +1142,18 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, - String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( - [arg_instanceId, arg_observerInstanceId, arg_keyPath]) - as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1298,27 +1168,22 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } - abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1334,61 +1199,69 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypesEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: - return WKWebsiteDataTypesEnumData.decode(readValue(buffer)!); - - default: + + case 135: + return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); + + default: return super.readValueOfType(type, buffer); + } } } @@ -1397,29 +1270,24 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create( - int arg_instanceId, int arg_configurationInstanceId) async { + Future create(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1430,22 +1298,18 @@ class WKWebViewHostApi { } } - Future setUIDelegate( - int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1456,22 +1320,18 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate( - int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_navigationDelegateInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1484,8 +1344,7 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1494,8 +1353,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1508,8 +1366,7 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1518,8 +1375,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1535,21 +1391,18 @@ class WKWebViewHostApi { } } - Future loadRequest( - int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1560,22 +1413,18 @@ class WKWebViewHostApi { } } - Future loadHtmlString( - int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) - as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1586,22 +1435,18 @@ class WKWebViewHostApi { } } - Future loadFileUrl( - int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_url, arg_readAccessUrl]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1614,18 +1459,16 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1638,8 +1481,7 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1648,8 +1490,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1667,8 +1508,7 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1677,8 +1517,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1696,8 +1535,7 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1706,8 +1544,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1720,8 +1557,7 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1730,8 +1566,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1744,8 +1579,7 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1754,8 +1588,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1768,8 +1601,7 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1778,8 +1610,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1790,22 +1621,18 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures( - int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1816,22 +1643,18 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent( - int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) - as Map?; + await channel.send([arg_instanceId, arg_userAgent]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1842,22 +1665,18 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript( - int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) - as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1877,8 +1696,7 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1886,8 +1704,7 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1896,8 +1713,7 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1916,25 +1732,27 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1943,30 +1761,24 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore( - int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_websiteDataStoreInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1977,21 +1789,18 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie( - int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index ec7bb5377de0..6112a729e7dd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -6,6 +6,7 @@ import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; import 'foundation_api_impls.dart'; @@ -13,6 +14,7 @@ import 'foundation_api_impls.dart'; /// The values that can be returned in a change map. /// /// Wraps [NSKeyValueObservingOptions](https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc). +@SimpleEnumAnnotation() enum NSKeyValueObservingOptions { /// Indicates that the change map should provide the new attribute value, if applicable. /// @@ -38,6 +40,7 @@ enum NSKeyValueObservingOptions { /// The kinds of changes that can be observed. /// /// Wraps [NSKeyValueChange](https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc). +@SimpleEnumAnnotation() enum NSKeyValueChange { /// Indicates that the value of the observed key path was set to a new value. /// @@ -63,6 +66,7 @@ enum NSKeyValueChange { /// The keys that can appear in the change map. /// /// Wraps [NSKeyValueChangeKey](https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc). +@SimpleEnumAnnotation() enum NSKeyValueChangeKey { /// Indicates changes made in a collection. /// @@ -93,6 +97,7 @@ enum NSKeyValueChangeKey { /// The supported keys in a cookie attributes dictionary. /// /// Wraps [NSHTTPCookiePropertyKey](https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey). +@SimpleEnumAnnotation() enum NSHttpCookiePropertyKey { /// A String object containing the comment for the cookie. /// @@ -197,6 +202,7 @@ class NSUrlRequest { /// /// Wraps [NSError](https://developer.apple.com/documentation/foundation/nserror?language=objc). @immutable +@SimpleClassAnnotation(customValues: {'isDataClass': true}) class NSError { /// Constructs an [NSError]. const NSError({ @@ -221,6 +227,7 @@ class NSError { /// /// Wraps [NSHTTPCookie](https://developer.apple.com/documentation/foundation/nshttpcookie). @immutable +@SimpleClassAnnotation(customValues: {'isDataClass': true}) class NSHttpCookie { /// Initializes an HTTP cookie object using the provided properties. const NSHttpCookie.withProperties(this.properties); @@ -230,6 +237,7 @@ class NSHttpCookie { } /// The root class of most Objective-C class hierarchies. +@SimpleClassAnnotation() class NSObject { /// Constructs an [NSObject]. NSObject({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) @@ -270,6 +278,7 @@ class NSObject { } /// Informs the observing object when the value at the specified key path has changed. + @SimpleMethodAnnotation(ignore: true) Future setObserveValue( void Function( String keyPath, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json new file mode 100644 index 000000000000..bac99f02486a --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json @@ -0,0 +1,928 @@ +{ + "classes": [ + { + "name": "NSError", + "methods": [], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "code", + "type": { + "name": "int", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "domain", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "localizedDescription", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [ + { + "name": "code", + "type": { + "name": "int", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "domain", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "localizedDescription", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ], + "customValues": { + "isDataClass": true + } + }, + { + "name": "NSHttpCookie", + "methods": [], + "constructors": [ + { + "name": "withProperties", + "parameters": [ + { + "name": "properties", + "type": { + "name": "Map", + "nullable": false, + "typeArguments": [ + { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + { + "name": "Object", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [ + { + "name": "properties", + "type": { + "name": "Map", + "nullable": false, + "typeArguments": [ + { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + { + "name": "Object", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ], + "customValues": { + "isDataClass": true + } + }, + { + "name": "NSObject", + "methods": [ + { + "name": "addObserver", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "observer", + "type": { + "name": "NSObject", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "keyPath", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "options", + "type": { + "name": "Set", + "nullable": false, + "typeArguments": [ + { + "name": "NSKeyValueObservingOptions", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + }, + { + "name": "removeObserver", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "observer", + "type": { + "name": "NSObject", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "keyPath", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + }, + { + "name": "dispose", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [], + "customValues": {} + } + ], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": {} + } + ], + "functions": [], + "enums": [ + { + "name": "NSKeyValueObservingOptions", + "values": [ + { + "name": "newValue", + "type": { + "name": "NSKeyValueObservingOptions", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "oldValue", + "type": { + "name": "NSKeyValueObservingOptions", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "initialValue", + "type": { + "name": "NSKeyValueObservingOptions", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "priorNotification", + "type": { + "name": "NSKeyValueObservingOptions", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "NSKeyValueChange", + "values": [ + { + "name": "setting", + "type": { + "name": "NSKeyValueChange", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "insertion", + "type": { + "name": "NSKeyValueChange", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "removal", + "type": { + "name": "NSKeyValueChange", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "replacement", + "type": { + "name": "NSKeyValueChange", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "NSKeyValueChangeKey", + "values": [ + { + "name": "indexes", + "type": { + "name": "NSKeyValueChangeKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "kind", + "type": { + "name": "NSKeyValueChangeKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "newValue", + "type": { + "name": "NSKeyValueChangeKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "notificationIsPrior", + "type": { + "name": "NSKeyValueChangeKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "oldValue", + "type": { + "name": "NSKeyValueChangeKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "NSHttpCookiePropertyKey", + "values": [ + { + "name": "comment", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "commentUrl", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "discard", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "domain", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "expires", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "maximumAge", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "name", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "originUrl", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "path", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "port", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "sameSitePolicy", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "secure", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "value", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "version", + "type": { + "name": "NSHttpCookiePropertyKey", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart index 7c1bdd01724c..6691d3b586cf 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart @@ -6,6 +6,7 @@ import 'dart:math'; import 'package:flutter/painting.dart' show Color; import 'package:flutter/services.dart'; +import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; import '../foundation/foundation.dart'; @@ -15,6 +16,7 @@ import 'ui_kit_api_impls.dart'; /// A view that allows the scrolling and zooming of its contained views. /// /// Wraps [UIScrollView](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc). +@SimpleClassAnnotation() class UIScrollView extends UIView { /// Constructs a [UIScrollView] that is owned by [webView]. UIScrollView.fromWebView( @@ -58,6 +60,7 @@ class UIScrollView extends UIView { /// Manages the content for a rectangular area on the screen. /// /// Wraps [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc). +@SimpleClassAnnotation() class UIView extends NSObject { /// Constructs an [NSObject]. UIView({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json new file mode 100644 index 000000000000..587261dbe9ee --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json @@ -0,0 +1,403 @@ +{ + "classes": [ + { + "name": "UIScrollView", + "methods": [ + { + "name": "getContentOffset", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "Point", + "nullable": false, + "typeArguments": [ + { + "name": "double", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [], + "customValues": {} + }, + { + "name": "scrollBy", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "offset", + "type": { + "name": "Point", + "nullable": false, + "typeArguments": [ + { + "name": "double", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + }, + { + "name": "setContentOffset", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "offset", + "type": { + "name": "Point", + "nullable": false, + "typeArguments": [ + { + "name": "double", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + } + ], + "constructors": [ + { + "name": "fromWebView", + "parameters": [ + { + "name": "webView", + "type": { + "name": "WKWebView", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": {} + }, + { + "name": "UIView", + "methods": [ + { + "name": "setBackgroundColor", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "color", + "type": { + "name": "Color", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + }, + { + "name": "setOpaque", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "opaque", + "type": { + "name": "bool", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ], + "customValues": {} + } + ], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": {} + } + ], + "functions": [], + "enums": [] +} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h new file mode 100644 index 000000000000..deab281506ce --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h @@ -0,0 +1,36 @@ + +/** + * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. + * + * @param data The data object containing information to create an NSKeyValueObservingOptions. + * + * @return An NSKeyValueObservingOptions or -1 if data could not be converted. + */ +extern NSUInteger FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); + +/** + * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. + * + * @param data The data object containing information to create an NSKeyValueChange. + * + * @return An NSKeyValueChange or -1 if data could not be converted. + */ +extern NSUInteger FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data); + +/** + * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. + * + * @param data The data object containing information to create an NSKeyValueChangeKey. + * + * @return An NSKeyValueChangeKey or -1 if data could not be converted. + */ +extern NSUInteger FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data); + +/** + * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. + * + * @param data The data object containing information to create an NSHttpCookiePropertyKey. + * + * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. + */ +extern NSUInteger FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m new file mode 100644 index 000000000000..543ec2998ede --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m @@ -0,0 +1,113 @@ + +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { + switch(data.value) { + + case FWFNSKeyValueObservingOptionsEnumNewValue: + return NSKeyValueObservingOptionsNewValue; + + case FWFNSKeyValueObservingOptionsEnumOldValue: + return NSKeyValueObservingOptionsOldValue; + + case FWFNSKeyValueObservingOptionsEnumInitialValue: + return NSKeyValueObservingOptionsInitialValue; + + case FWFNSKeyValueObservingOptionsEnumPriorNotification: + return NSKeyValueObservingOptionsPriorNotification; + + } + + return -1; +} + +NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data) { + switch(data.value) { + + case FWFNSKeyValueChangeEnumSetting: + return NSKeyValueChangeSetting; + + case FWFNSKeyValueChangeEnumInsertion: + return NSKeyValueChangeInsertion; + + case FWFNSKeyValueChangeEnumRemoval: + return NSKeyValueChangeRemoval; + + case FWFNSKeyValueChangeEnumReplacement: + return NSKeyValueChangeReplacement; + + } + + return -1; +} + +NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data) { + switch(data.value) { + + case FWFNSKeyValueChangeKeyEnumIndexes: + return NSKeyValueChangeKeyIndexes; + + case FWFNSKeyValueChangeKeyEnumKind: + return NSKeyValueChangeKeyKind; + + case FWFNSKeyValueChangeKeyEnumNewValue: + return NSKeyValueChangeKeyNewValue; + + case FWFNSKeyValueChangeKeyEnumNotificationIsPrior: + return NSKeyValueChangeKeyNotificationIsPrior; + + case FWFNSKeyValueChangeKeyEnumOldValue: + return NSKeyValueChangeKeyOldValue; + + } + + return -1; +} + +NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { + switch(data.value) { + + case FWFNSHttpCookiePropertyKeyEnumComment: + return NSHttpCookiePropertyKeyComment; + + case FWFNSHttpCookiePropertyKeyEnumCommentUrl: + return NSHttpCookiePropertyKeyCommentUrl; + + case FWFNSHttpCookiePropertyKeyEnumDiscard: + return NSHttpCookiePropertyKeyDiscard; + + case FWFNSHttpCookiePropertyKeyEnumDomain: + return NSHttpCookiePropertyKeyDomain; + + case FWFNSHttpCookiePropertyKeyEnumExpires: + return NSHttpCookiePropertyKeyExpires; + + case FWFNSHttpCookiePropertyKeyEnumMaximumAge: + return NSHttpCookiePropertyKeyMaximumAge; + + case FWFNSHttpCookiePropertyKeyEnumName: + return NSHttpCookiePropertyKeyName; + + case FWFNSHttpCookiePropertyKeyEnumOriginUrl: + return NSHttpCookiePropertyKeyOriginUrl; + + case FWFNSHttpCookiePropertyKeyEnumPath: + return NSHttpCookiePropertyKeyPath; + + case FWFNSHttpCookiePropertyKeyEnumPort: + return NSHttpCookiePropertyKeyPort; + + case FWFNSHttpCookiePropertyKeyEnumSameSitePolicy: + return NSHttpCookiePropertyKeySameSitePolicy; + + case FWFNSHttpCookiePropertyKeyEnumSecure: + return NSHttpCookiePropertyKeySecure; + + case FWFNSHttpCookiePropertyKeyEnumValue: + return NSHttpCookiePropertyKeyValue; + + case FWFNSHttpCookiePropertyKeyEnumVersion: + return NSHttpCookiePropertyKeyVersion; + + } + + return -1; +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h new file mode 100644 index 000000000000..60741663a5cb --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h @@ -0,0 +1,10 @@ +/*-iterate enums enum*/ +/** + * Converts an FWF__name__EnumData to an __name__. + * + * @param data The data object containing information to create an __name__. + * + * @return An __name__ or -1 if data could not be converted. + */ +extern __name__ FWF__name__FromEnumData(FWF__name__EnumData *data); +/*-*/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m new file mode 100644 index 000000000000..1d8e1c8e143a --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m @@ -0,0 +1,12 @@ +/*iterate enums enum*/ +__name__ FWF__name__FromEnumData(FWF__name__EnumData *data) { + switch(data.value) { + /*iterate values value*/ + case FWF__enum_name__Enum/*replace :case=pascal name*/name/**/: + return __enum_name__/*replace :case=pascal name*/name/**/; + /**/ + } + + return -1; +} +/**/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h new file mode 100644 index 000000000000..6c846cfb8180 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h @@ -0,0 +1,212 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKPreferences. + * + * Handles creating WKPreferences that intercommunicate with a paired Dart object. + */ +@interface FWFPreferencesHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKWebsiteDataStore. + * + * Handles creating WKWebsiteDataStore that intercommunicate with a paired Dart object. + */ +@interface FWFWebsiteDataStoreHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKHttpCookieStore. + * + * Handles creating WKHttpCookieStore that intercommunicate with a paired Dart object. + */ +@interface FWFHttpCookieStoreHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKScriptMessageHandler. + * + * Handles creating WKScriptMessageHandler that intercommunicate with a paired Dart object. + */ +@interface FWFScriptMessageHandlerHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKUserContentController. + * + * Handles creating WKUserContentController that intercommunicate with a paired Dart object. + */ +@interface FWFUserContentControllerHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for WKWebViewConfiguration. + * + * Handles creating WKWebViewConfiguration that intercommunicate with a paired Dart object. + */ +@interface FWFWebViewConfigurationHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + +/** + * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. + */ +@interface FWFUIDelegate : NSObject +@end + + +/** + * Host api implementation for WKUIDelegate. + * + * Handles creating WKUIDelegate that intercommunicate with a paired Dart object. + */ +@interface FWFUIDelegateHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + +/** + * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. + */ +@interface FWFNavigationDelegate : NSObject +@end + + +/** + * Host api implementation for WKNavigationDelegate. + * + * Handles creating WKNavigationDelegate that intercommunicate with a paired Dart object. + */ +@interface FWFNavigationDelegateHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m new file mode 100644 index 000000000000..6591dfde2d9b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m @@ -0,0 +1,626 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFPreferencesHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFPreferencesHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFPreferencesHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKPreferences + + *)preferencesForIdentifier:(NSNumber *)instanceId { + return ( + + + WKPreferences + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKPreferences + + *preferences = + + + [[WKPreferences alloc] init]; + + [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; +} + + +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId + + enabled:(nonnull NSNumber *)enabled + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self preferencesForIdentifier:instanceId] setJavaScriptEnabled + + :enabled + + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFWebsiteDataStoreHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFWebsiteDataStoreHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFWebsiteDataStoreHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKWebsiteDataStore + + *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { + return ( + + + WKWebsiteDataStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKWebsiteDataStore + + *websiteDataStore = + + + [[WKWebsiteDataStore alloc] init]; + + [self.instanceManager addInstance:websiteDataStore withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.websiteDataStore withIdentifier:instanceId.longValue]; +} + + +- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + + dataTypes:(nonnull NSArray *)dataTypes + + since:(nonnull NSNumber *)since + + error:(FlutterError *_Nullable *_Nonnull) error { + return + [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes + + :dataTypes + + + since:since + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFHttpCookieStoreHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFHttpCookieStoreHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFHttpCookieStoreHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKHttpCookieStore + + *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { + return ( + + + WKHttpCookieStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKHttpCookieStore + + *httpCookieStore = + + + [[WKHttpCookieStore alloc] init]; + + [self.instanceManager addInstance:httpCookieStore withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.httpCookieStore withIdentifier:instanceId.longValue]; +} + + +- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId + + cookie:(nonnull NSHttpCookie *)cookie + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self httpCookieStoreForIdentifier:instanceId] setCookie + + :cookie + + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFScriptMessageHandlerHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFScriptMessageHandlerHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScriptMessageHandlerHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKScriptMessageHandler + + *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { + return ( + + + WKScriptMessageHandler + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKScriptMessageHandler + + *scriptMessageHandler = + + + [[WKScriptMessageHandler alloc] init]; + + [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.scriptMessageHandler withIdentifier:instanceId.longValue]; +} + + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFUserContentControllerHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFUserContentControllerHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUserContentControllerHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKUserContentController + + *)userContentControllerForIdentifier:(NSNumber *)instanceId { + return ( + + + WKUserContentController + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKUserContentController + + *userContentController = + + + [[WKUserContentController alloc] init]; + + [self.instanceManager addInstance:userContentController withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.userContentController withIdentifier:instanceId.longValue]; +} + + +- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + handler:(nonnull WKScriptMessageHandler *)handler + + name:(nonnull NSString *)name + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self userContentControllerForIdentifier:instanceId] addScriptMessageHandler + + :handler + + + name:name + + ]; +} + +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + name:(nonnull NSString *)name + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandler + + :name + + + ]; +} + +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers + + + ]; +} + +- (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + userScript:(nonnull WKUserScript *)userScript + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self userContentControllerForIdentifier:instanceId] addUserScript + + :userScript + + + ]; +} + +- (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self userContentControllerForIdentifier:instanceId] removeAllUserScripts + + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + + +@interface FWFWebViewConfigurationHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFWebViewConfigurationHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + WKWebViewConfiguration + + *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + return ( + + + WKWebViewConfiguration + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + WKWebViewConfiguration + + *webViewConfiguration = + + + [[WKWebViewConfiguration alloc] init]; + + [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.webViewConfiguration withIdentifier:instanceId.longValue]; +} + + +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + + allow:(nonnull NSNumber *)allow + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback + + :allow + + + ]; +} + +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + + types:(nonnull NSArray *)types + + error:(FlutterError *_Nullable *_Nonnull) error { + + [[self webViewConfigurationForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback + + :types + + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFUIDelegateHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + +@implementation FWFUIDelegate +@end + + +@interface FWFUIDelegateHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUIDelegateHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + FWFUIDelegate + + + *)uIDelegateForIdentifier:(NSNumber *)instanceId { + return ( + + FWFUIDelegate + + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + FWFUIDelegate + + + *uIDelegate = + + [[FWFUIDelegate alloc] init]; + + + [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.uIDelegate withIdentifier:instanceId.longValue]; +} + + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFNavigationDelegateHostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + + +@implementation FWFNavigationDelegate +@end + + +@interface FWFNavigationDelegateHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFNavigationDelegateHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + FWFNavigationDelegate + + + *)navigationDelegateForIdentifier:(NSNumber *)instanceId { + return ( + + FWFNavigationDelegate + + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + FWFNavigationDelegate + + + *navigationDelegate = + + [[FWFNavigationDelegate alloc] init]; + + + [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.navigationDelegate withIdentifier:instanceId.longValue]; +} + + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m new file mode 100644 index 000000000000..972ede99c9f2 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m @@ -0,0 +1,436 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFPreferencesHostApiTests : XCTestCase +@end + +@implementation FWFPreferencesHostApiTests + +- (void)testSetJavaScriptEnabled { + FWFWebView *mockPreferences = OCMClassMock([ + + + setJavaScriptEnabled + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockPreferences withIdentifier:0]; + + FWFPreferencesHostApiImpl *hostApi = + [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setJavaScriptEnabledForPreferencesWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView setJavaScriptEnabled: + + :aValue + + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFWebsiteDataStoreHostApiTests : XCTestCase +@end + +@implementation FWFWebsiteDataStoreHostApiTests + +- (void)testRemoveDataOfTypes { + FWFWebView *mockWebsiteDataStore = OCMClassMock([ + + + removeDataOfTypes + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; + + FWFWebsiteDataStoreHostApiImpl *hostApi = + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeDataFromDataStoreWithIdentifier + + :aValue + + + since:aValue + + error:&error]; + OCMVerify([mockWebView removeDataOfTypes: + + :aValue + + + since:aValue + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFHttpCookieStoreHostApiTests : XCTestCase +@end + +@implementation FWFHttpCookieStoreHostApiTests + +- (void)testSetCookie { + FWFWebView *mockHttpCookieStore = OCMClassMock([ + + + setCookie + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockHttpCookieStore withIdentifier:0]; + + FWFHttpCookieStoreHostApiImpl *hostApi = + [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setCookieForStoreWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView setCookie: + + :aValue + + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFScriptMessageHandlerHostApiTests : XCTestCase +@end + +@implementation FWFScriptMessageHandlerHostApiTests + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUserContentControllerHostApiTests : XCTestCase +@end + +@implementation FWFUserContentControllerHostApiTests + +- (void)testAddScriptMessageHandler { + FWFWebView *mockUserContentController = OCMClassMock([ + + + addScriptMessageHandler + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi addScriptMessageHandlerForControllerWithIdentifier + + :aValue + + + name:aValue + + error:&error]; + OCMVerify([mockWebView addScriptMessageHandler: + + :aValue + + + name:aValue + + ]); + XCTAssertNil(error); +} + +- (void)testRemoveScriptMessageHandler { + FWFWebView *mockUserContentController = OCMClassMock([ + + + removeScriptMessageHandler + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeScriptMessageHandlerForControllerWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView removeScriptMessageHandler: + + :aValue + + + ]); + XCTAssertNil(error); +} + +- (void)testRemoveAllScriptMessageHandlers { + FWFWebView *mockUserContentController = OCMClassMock([ + + + removeAllScriptMessageHandlers + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier + + + error:&error]; + OCMVerify([mockWebView removeAllScriptMessageHandlers: + + + ]); + XCTAssertNil(error); +} + +- (void)testAddUserScript { + FWFWebView *mockUserContentController = OCMClassMock([ + + + addUserScript + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi addUserScriptForControllerWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView addUserScript: + + :aValue + + + ]); + XCTAssertNil(error); +} + +- (void)testRemoveAllUserScripts { + FWFWebView *mockUserContentController = OCMClassMock([ + + + removeAllUserScripts + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeAllUserScriptsForControllerWithIdentifier + + + error:&error]; + OCMVerify([mockWebView removeAllUserScripts: + + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFWebViewConfigurationHostApiTests : XCTestCase +@end + +@implementation FWFWebViewConfigurationHostApiTests + +- (void)testSetAllowsInlineMediaPlayback { + FWFWebView *mockWebViewConfiguration = OCMClassMock([ + + + setAllowsInlineMediaPlayback + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; + + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView setAllowsInlineMediaPlayback: + + :aValue + + + ]); + XCTAssertNil(error); +} + +- (void)testSetMediaTypesRequiringUserActionForPlayback { + FWFWebView *mockWebViewConfiguration = OCMClassMock([ + + + setMediaTypesRequiringUserActionForPlayback + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; + + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier + + :aValue + + + error:&error]; + OCMVerify([mockWebView setMediaTypesRequiringUserActionForPlayback: + + :aValue + + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUIDelegateHostApiTests : XCTestCase +@end + +@implementation FWFUIDelegateHostApiTests + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFNavigationDelegateHostApiTests : XCTestCase +@end + +@implementation FWFNavigationDelegateHostApiTests + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h new file mode 100644 index 000000000000..9e3c9487c0bb --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h @@ -0,0 +1,32 @@ +/*-iterate classes class*/ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/*-if customValues_isProtocol*/ +/** + * Implementation of __name__ for FWF__customValues_nameWithoutPrefix__HostApiImpl. + */ +@interface FWF__customValues_nameWithoutPrefix__ : NSObject<__name__> +@end +/*-*/ + +/** + * Host api implementation for __name__. + * + * Handles creating __name__ that intercommunicate with a paired Dart object. + */ +@interface FWF__customValues_nameWithoutPrefix__HostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END +/*-*/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m new file mode 100644 index 000000000000..fb4f9b1b832b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m @@ -0,0 +1,88 @@ +/*iterate classes class*/ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWF__customValues_nameWithoutPrefix__HostApi.h" +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" + +/*if customValues_isProtocol*/ +@implementation FWF__customValues_nameWithoutPrefix__ +@end +/**/ + +@interface FWF__customValues_nameWithoutPrefix__HostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWF__customValues_nameWithoutPrefix__HostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (/*if customValues_isProtocol*/ + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + *)/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ForIdentifier:(NSNumber *)instanceId { + return ( + /*if customValues_isProtocol*/ + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + /*if customValues_isProtocol*/ + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + */*replace :case=camel customValues_nameWithoutPrefix*/name/**/ = + /*if customValues_isProtocol*/ + [[FWF__customValues_nameWithoutPrefix__ alloc] init]; + /**/ + /*if! customValues_isProtocol*/ + [[__name__ alloc] init]; + /**/ + [self.instanceManager addInstance:/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration./*replace :case=camel customValues_nameWithoutPrefix*/name/**/ withIdentifier:instanceId.longValue]; +} + +/*iterate methods method*/ +- (void)__customValues_objcName__:(nonnull NSNumber *)instanceId +/*iterate parameters parameter*/ + __name__:(/*if type_nullable*/nullable/**//*if! type_nullable*/nonnull/**/ __type_customValues_objcName__ *)__name__ +/**/ + error:(FlutterError *_Nullable *_Nonnull) error { + /*if! customValues_returnsVoid*/return/**/ + [[self /*replace :case=camel class_customValues_nameWithoutPrefix*/name/**/ForIdentifier:instanceId] __name__ + /*iterate :end=1 parameters parameter*/ + :__name__ + /**/ + /*iterate :start=1 parameters parameter*/ + __name__:__name__ + /**/ + ]; +} +/**/ +@end +/**/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m new file mode 100644 index 000000000000..ed426c3bb6e9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m @@ -0,0 +1,54 @@ +/*iterate classes class*/ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWF__customValues_nameWithoutPrefix__HostApiTests : XCTestCase +@end + +@implementation FWF__customValues_nameWithoutPrefix__HostApiTests +/*iterate methods method*/ +- (void)test/*replace :case=pascal name*/methodName/**/ { + FWFWebView *mock__class_customValues_nameWithoutPrefix__ = OCMClassMock([ + /*if class_customValues_isProtocol*/ + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! class_customValues_isProtocol*/ + __name__ + /**/ + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mock__class_customValues_nameWithoutPrefix__ withIdentifier:0]; + + FWF__class_customValues_nameWithoutPrefix__HostApiImpl *hostApi = + [[FWF__class_customValues_nameWithoutPrefix__HostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi __customValues_objcName__ + /*iterate :end=1 parameters parameter*/ + :aValue + /**/ + /*iterate :start=1 parameters parameter*/ + __name__:aValue + /**/ + error:&error]; + OCMVerify([mockWebView __name__: + /*iterate :end=1 parameters parameter*/ + :aValue + /**/ + /*iterate :start=1 parameters parameter*/ + __name__:aValue + /**/ + ]); + XCTAssertNil(error); +} +/**/ +@end +/**/ \ No newline at end of file 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 ab63db67bba1..0dc2d54ad1b6 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 @@ -4,15 +4,25 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; import '../foundation/foundation.dart'; import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; +const SimpleTypeAnnotation nsString = SimpleTypeAnnotation( + customValues: {'objcName': 'NSString'}, +); + +const SimpleTypeAnnotation nsNumber = SimpleTypeAnnotation( + customValues: {'objcName': 'NSNumber'}, +); + /// Times at which to inject script content into a webpage. /// /// Wraps [WKUserScriptInjectionTime](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc). +@SimpleEnumAnnotation() enum WKUserScriptInjectionTime { /// Inject the script after the creation of the webpage’s document element, but before loading any other content. /// @@ -28,6 +38,7 @@ enum WKUserScriptInjectionTime { /// The media types that require a user gesture to begin playing. /// /// Wraps [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). +@SimpleEnumAnnotation() enum WKAudiovisualMediaType { /// No media types require a user gesture to begin playing. /// @@ -53,7 +64,8 @@ enum WKAudiovisualMediaType { /// Types of data that websites store. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. -enum WKWebsiteDataTypes { +@SimpleEnumAnnotation() +enum WKWebsiteDataType { /// Cookies. cookies, @@ -67,13 +79,13 @@ enum WKWebsiteDataTypes { offlineWebApplicationCache, /// HTML local storage. - localStroage, + localStorage, /// HTML session storage. sessionStorage, /// WebSQL databases. - sqlDatabases, + webSQLDatabases, /// IndexedDB databases. indexedDBDatabases, @@ -210,6 +222,10 @@ class WKScriptMessage { /// Encapsulates the standard behaviors to apply to websites. /// /// Wraps [WKPreferences](https://developer.apple.com/documentation/webkit/wkpreferences?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'Preferences', + 'isProtocol': false, +}) class WKPreferences { /// Constructs a [WKPreferences] that is owned by [configuration]. @visibleForTesting @@ -233,7 +249,11 @@ class WKPreferences { /// Sets whether JavaScript is enabled. /// /// The default value is true. - Future setJavaScriptEnabled(bool enabled) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setJavaScriptEnabledForPreferencesWithIdentifier', + 'returnsVoid': true, + }) + Future setJavaScriptEnabled(@nsNumber bool enabled) { return _preferencesApi.setJavaScriptEnabledForInstances(this, enabled); } } @@ -241,6 +261,10 @@ class WKPreferences { /// Manages cookies, disk and memory caches, and other types of data for a web view. /// /// Wraps [WKWebsiteDataStore](https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'WebsiteDataStore', + 'isProtocol': false, +}) class WKWebsiteDataStore { WKWebsiteDataStore._({ BinaryMessenger? binaryMessenger, @@ -290,9 +314,17 @@ class WKWebsiteDataStore { /// Removes website data that changed after the specified date. /// /// Returns whether any data was removed. + @nsNumber + @SimpleMethodAnnotation(customValues: { + 'objcName': 'removeDataFromDataStoreWithIdentifier', + 'returnsVoid': false, + }) Future removeDataOfTypes( - Set dataTypes, - DateTime since, + @SimpleTypeAnnotation(customValues: { + 'objcName': 'NSArray' + }) + Set dataTypes, + @nsNumber DateTime since, ) { return _websiteDataStoreApi.removeDataOfTypesForInstances( this, @@ -305,6 +337,10 @@ class WKWebsiteDataStore { /// An object that manages the HTTP cookies associated with a particular web view. /// /// Wraps [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'HttpCookieStore', + 'isProtocol': false, +}) class WKHttpCookieStore extends NSObject { WKHttpCookieStore._({ BinaryMessenger? binaryMessenger, @@ -335,7 +371,15 @@ class WKHttpCookieStore extends NSObject { final WKHttpCookieStoreHostApiImpl _httpCookieStoreApi; /// Adds a cookie to the cookie store. - Future setCookie(NSHttpCookie cookie) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setCookieForStoreWithIdentifier', + 'returnsVoid': true, + }) + Future setCookie( + @SimpleTypeAnnotation(customValues: { + 'objcName': 'NSHttpCookie' + }) + NSHttpCookie cookie) { return _httpCookieStoreApi.setCookieForInsances(this, cookie); } } @@ -343,6 +387,10 @@ class WKHttpCookieStore extends NSObject { /// An interface for receiving messages from JavaScript code running in a webpage. /// /// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc) +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'ScriptMessageHandler', + 'isProtocol': false, +}) class WKScriptMessageHandler { /// Constructs a [WKScriptMessageHandler]. WKScriptMessageHandler({ @@ -362,6 +410,7 @@ class WKScriptMessageHandler { /// Use this method to respond to a message sent from the webpage’s /// JavaScript code. Use the [message] parameter to get the message contents and /// to determine the originating web view. + @SimpleMethodAnnotation(ignore: true) Future setDidReceiveScriptMessage( void Function( WKUserContentController userContentController, @@ -382,6 +431,10 @@ class WKScriptMessageHandler { /// code. /// /// Wraps [WKUserContentController](https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'UserContentController', + 'isProtocol': false, +}) class WKUserContentController { /// Constructs a [WKUserContentController] that is owned by [configuration]. @visibleForTesting @@ -412,9 +465,16 @@ class WKUserContentController { /// specify the string `MyFunction`, the user content controller defines the ` /// `window.webkit.messageHandlers.MyFunction.postMessage()` function in /// JavaScript. + @SimpleMethodAnnotation(customValues: { + 'objcName': 'addScriptMessageHandlerForControllerWithIdentifier', + 'returnsVoid': true, + }) Future addScriptMessageHandler( - WKScriptMessageHandler handler, - String name, + @SimpleTypeAnnotation(customValues: { + 'objcName': 'WKScriptMessageHandler' + }) + WKScriptMessageHandler handler, + @nsString String name, ) { assert(name.isNotEmpty); return _userContentControllerApi.addScriptMessageHandlerForInstances( @@ -433,7 +493,11 @@ class WKUserContentController { /// using the [addScriptMessageHandler] method. This method removes the /// message handler from the page content world. If you installed the message /// handler in a different content world, this method doesn’t remove it. - Future removeScriptMessageHandler(String name) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'removeScriptMessageHandlerForControllerWithIdentifier', + 'returnsVoid': true, + }) + Future removeScriptMessageHandler(@nsString String name) { return _userContentControllerApi.removeScriptMessageHandlerForInstances( this, name, @@ -441,6 +505,10 @@ class WKUserContentController { } /// Uninstalls all custom message handlers associated with the user content controller. + @SimpleMethodAnnotation(customValues: { + 'objcName': 'removeAllScriptMessageHandlersForControllerWithIdentifier', + 'returnsVoid': true, + }) Future removeAllScriptMessageHandlers() { return _userContentControllerApi.removeAllScriptMessageHandlersForInstances( this, @@ -448,12 +516,24 @@ class WKUserContentController { } /// Injects the specified script into the webpage’s content. - Future addUserScript(WKUserScript userScript) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'addUserScriptForControllerWithIdentifier', + 'returnsVoid': true, + }) + Future addUserScript( + @SimpleTypeAnnotation(customValues: { + 'objcName': 'WKUserScript' + }) + WKUserScript userScript) { return _userContentControllerApi.addUserScriptForInstances( this, userScript); } /// Removes all user scripts from the web view. + @SimpleMethodAnnotation(customValues: { + 'objcName': 'removeAllUserScriptsForControllerWithIdentifier', + 'returnsVoid': true, + }) Future removeAllUserScripts() { return _userContentControllerApi.removeAllUserScriptsForInstances(this); } @@ -462,6 +542,10 @@ class WKUserContentController { /// A collection of properties that you use to initialize a web view. /// /// Wraps [WKWebViewConfiguration](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'WebViewConfiguration', + 'isProtocol': false, +}) class WKWebViewConfiguration { /// Constructs a [WKWebViewConfiguration]. factory WKWebViewConfiguration({ @@ -534,7 +618,11 @@ class WKWebViewConfiguration { /// Indicates whether HTML5 videos play inline or use the native full-screen controller. /// /// Sets [WKWebViewConfiguration.allowsInlineMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback?language=objc). - Future setAllowsInlineMediaPlayback(bool allow) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setAllowsInlineMediaPlaybackForConfigurationWithIdentifier', + 'returnsVoid': true, + }) + Future setAllowsInlineMediaPlayback(@nsNumber bool allow) { return _webViewConfigurationApi.setAllowsInlineMediaPlaybackForInstances( this, allow, @@ -547,9 +635,17 @@ class WKWebViewConfiguration { /// required to begin playing media. /// /// Sets [WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor?language=objc). + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setMediaTypesRequiresUserActionForConfigurationWithIdentifier', + 'returnsVoid': true, + }) Future setMediaTypesRequiringUserActionForPlayback( - Set types, + @SimpleTypeAnnotation(customValues: { + 'objcName': 'NSArray' + }) + Set types, ) { + assert(types.isNotEmpty); return _webViewConfigurationApi .setMediaTypesRequiringUserActionForPlaybackForInstances( this, @@ -561,6 +657,10 @@ class WKWebViewConfiguration { /// The methods for presenting native user interface elements on behalf of a webpage. /// /// Wraps [WKUIDelegate](https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'UIDelegate', + 'isProtocol': true, +}) class WKUIDelegate { /// Constructs a [WKUIDelegate]. WKUIDelegate({ @@ -576,6 +676,7 @@ class WKUIDelegate { final WKUIDelegateHostApiImpl _uiDelegateApi; /// Indicates a new [WKWebView] was requested to be created with [configuration]. + @SimpleMethodAnnotation(ignore: true) Future setOnCreateWebView( void Function( WKWebViewConfiguration configuration, @@ -593,6 +694,10 @@ class WKUIDelegate { /// coordinate changes in your web view’s main frame. /// /// Wraps [WKNavigationDelegate](https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc). +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'NavigationDelegate', + 'isProtocol': true, +}) class WKNavigationDelegate extends NSObject { /// Constructs a [WKNavigationDelegate]. WKNavigationDelegate({ @@ -613,6 +718,7 @@ class WKNavigationDelegate extends NSObject { final WKNavigationDelegateHostApiImpl _navigationDelegateApi; /// Called when navigation from the main frame has started. + @SimpleMethodAnnotation(ignore: true) Future setDidStartProvisionalNavigation( void Function(WKWebView webView, String? url)? didStartProvisionalNavigation, @@ -621,6 +727,7 @@ class WKNavigationDelegate extends NSObject { } /// Called when navigation is complete. + @SimpleMethodAnnotation(ignore: true) Future setDidFinishNavigation( void Function(WKWebView webView, String? url)? didFinishNavigation, ) { @@ -631,6 +738,7 @@ class WKNavigationDelegate extends NSObject { } /// Called when permission is needed to navigate to new content. + @SimpleMethodAnnotation(ignore: true) Future setDecidePolicyForNavigationAction( Future Function( WKWebView webView, @@ -641,6 +749,7 @@ class WKNavigationDelegate extends NSObject { } /// Called when an error occurred during navigation. + @SimpleMethodAnnotation(ignore: true) Future setDidFailNavigation( void Function(WKWebView webView, NSError error)? didFailNavigation, ) { @@ -648,6 +757,7 @@ class WKNavigationDelegate extends NSObject { } /// Called when an error occurred during the early navigation process. + @SimpleMethodAnnotation(ignore: true) Future setDidFailProvisionalNavigation( void Function(WKWebView webView, NSError error)? didFailProvisionalNavigation, @@ -656,6 +766,7 @@ class WKNavigationDelegate extends NSObject { } /// Called when the web view’s content process was terminated. + @SimpleMethodAnnotation(ignore: true) Future setWebViewWebContentProcessDidTerminate( void Function(WKWebView webView)? webViewWebContentProcessDidTerminate, ) { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json new file mode 100644 index 000000000000..2d8dfe9ce310 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json @@ -0,0 +1,1492 @@ +{ + "classes": [ + { + "name": "WKPreferences", + "methods": [ + { + "name": "setJavaScriptEnabled", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "enabled", + "type": { + "name": "bool", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSNumber" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "setJavaScriptEnabledForPreferencesWithIdentifier", + "returnsVoid": true + } + } + ], + "constructors": [ + { + "name": "fromWebViewConfiguration", + "parameters": [ + { + "name": "configuration", + "type": { + "name": "WKWebViewConfiguration", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "Preferences", + "isProtocol": false + } + }, + { + "name": "WKWebsiteDataStore", + "methods": [ + { + "name": "removeDataOfTypes", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "bool", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSNumber" + } + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "dataTypes", + "type": { + "name": "Set", + "nullable": false, + "typeArguments": [ + { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSArray" + } + }, + "customValues": {} + }, + { + "name": "since", + "type": { + "name": "DateTime", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSNumber" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "removeDataFromDataStoreWithIdentifier", + "returnsVoid": false + } + } + ], + "constructors": [ + { + "name": "fromWebViewConfiguration", + "parameters": [ + { + "name": "configuration", + "type": { + "name": "WKWebViewConfiguration", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [ + { + "name": "defaultDataStore", + "type": { + "name": "WKWebsiteDataStore", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "httpCookieStore", + "type": { + "name": "WKHttpCookieStore", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ], + "customValues": { + "nameWithoutPrefix": "WebsiteDataStore", + "isProtocol": false + } + }, + { + "name": "WKHttpCookieStore", + "methods": [ + { + "name": "setCookie", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "cookie", + "type": { + "name": "NSHttpCookie", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSHttpCookie" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "setCookieForStoreWithIdentifier", + "returnsVoid": true + } + } + ], + "constructors": [ + { + "name": "fromWebsiteDataStore", + "parameters": [ + { + "name": "dataStore", + "type": { + "name": "WKWebsiteDataStore", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "HttpCookieStore", + "isProtocol": false + } + }, + { + "name": "WKScriptMessageHandler", + "methods": [], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "ScriptMessageHandler", + "isProtocol": false + } + }, + { + "name": "WKUserContentController", + "methods": [ + { + "name": "addScriptMessageHandler", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "handler", + "type": { + "name": "WKScriptMessageHandler", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "WKScriptMessageHandler" + } + }, + "customValues": {} + }, + { + "name": "name", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSString" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "addScriptMessageHandlerForControllerWithIdentifier", + "returnsVoid": true + } + }, + { + "name": "removeScriptMessageHandler", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "name", + "type": { + "name": "String", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSString" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "removeScriptMessageHandlerForControllerWithIdentifier", + "returnsVoid": true + } + }, + { + "name": "removeAllScriptMessageHandlers", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [], + "customValues": { + "objcName": "removeAllScriptMessageHandlersForControllerWithIdentifier", + "returnsVoid": true + } + }, + { + "name": "addUserScript", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "userScript", + "type": { + "name": "WKUserScript", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "WKUserScript" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "addUserScriptForControllerWithIdentifier", + "returnsVoid": true + } + }, + { + "name": "removeAllUserScripts", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [], + "customValues": { + "objcName": "removeAllUserScriptsForControllerWithIdentifier", + "returnsVoid": true + } + } + ], + "constructors": [ + { + "name": "fromWebViewConfiguration", + "parameters": [ + { + "name": "configuration", + "type": { + "name": "WKWebViewConfiguration", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "UserContentController", + "isProtocol": false + } + }, + { + "name": "WKWebViewConfiguration", + "methods": [ + { + "name": "setAllowsInlineMediaPlayback", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "allow", + "type": { + "name": "bool", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSNumber" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "setAllowsInlineMediaPlaybackForConfigurationWithIdentifier", + "returnsVoid": true + } + }, + { + "name": "setMediaTypesRequiringUserActionForPlayback", + "returnType": { + "name": "Future", + "nullable": false, + "typeArguments": [ + { + "name": "void", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": true, + "isClass": false, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "returnsVoid": false, + "static": false, + "parameters": [ + { + "name": "types", + "type": { + "name": "Set", + "nullable": false, + "typeArguments": [ + { + "name": "WKAudiovisualMediaType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + ], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": { + "objcName": "NSArray" + } + }, + "customValues": {} + } + ], + "customValues": { + "objcName": "setMediaTypesRequiresUserActionForConfigurationWithIdentifier", + "returnsVoid": true + } + } + ], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + }, + { + "name": "fromWebView", + "parameters": [ + { + "name": "webView", + "type": { + "name": "WKWebView", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [ + { + "name": "userContentController", + "type": { + "name": "WKUserContentController", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "preferences", + "type": { + "name": "WKPreferences", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "websiteDataStore", + "type": { + "name": "WKWebsiteDataStore", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": true, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ], + "customValues": { + "nameWithoutPrefix": "WebViewConfiguration", + "isProtocol": false + } + }, + { + "name": "WKUIDelegate", + "methods": [], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "UIDelegate", + "isProtocol": true + } + }, + { + "name": "WKNavigationDelegate", + "methods": [], + "constructors": [ + { + "name": "", + "parameters": [ + { + "name": "binaryMessenger", + "type": { + "name": "BinaryMessenger", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + }, + { + "name": "instanceManager", + "type": { + "name": "InstanceManager", + "nullable": true, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": true, + "isFunction": false, + "isEnum": false, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + }, + "customValues": {} + } + ] + } + ], + "fields": [], + "customValues": { + "nameWithoutPrefix": "NavigationDelegate", + "isProtocol": true + } + } + ], + "functions": [], + "enums": [ + { + "name": "WKUserScriptInjectionTime", + "values": [ + { + "name": "atDocumentStart", + "type": { + "name": "WKUserScriptInjectionTime", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "atDocumentEnd", + "type": { + "name": "WKUserScriptInjectionTime", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "WKAudiovisualMediaType", + "values": [ + { + "name": "none", + "type": { + "name": "WKAudiovisualMediaType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "audio", + "type": { + "name": "WKAudiovisualMediaType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "video", + "type": { + "name": "WKAudiovisualMediaType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "all", + "type": { + "name": "WKAudiovisualMediaType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "WKWebsiteDataType", + "values": [ + { + "name": "cookies", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "memoryCache", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "diskCache", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "offlineWebApplicationCache", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "localStorage", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "sessionStorage", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "webSQLDatabases", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "indexedDBDatabases", + "type": { + "name": "WKWebsiteDataType", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + }, + { + "name": "WKNavigationActionPolicy", + "values": [ + { + "name": "allow", + "type": { + "name": "WKNavigationActionPolicy", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + }, + { + "name": "cancel", + "type": { + "name": "WKNavigationActionPolicy", + "nullable": false, + "typeArguments": [], + "functionParameters": [], + "isVoid": false, + "isClass": false, + "isFunction": false, + "isEnum": true, + "isSimpleClass": false, + "isUnknownOrUnsupportedType": false, + "customValues": {} + } + } + ] + } + ] +} \ No newline at end of file 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 b970ab26bcc7..ea7f776047b3 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,38 +10,38 @@ import '../common/web_kit.pigeon.dart'; import '../foundation/foundation.dart'; import 'web_kit.dart'; -Iterable _toWKWebsiteDataTypesEnumData( - Iterable types) { - return types.map((WKWebsiteDataTypes type) { - late final WKWebsiteDataTypesEnum value; +Iterable _toWKWebsiteDataTypeEnumData( + Iterable types) { + return types.map((WKWebsiteDataType type) { + late final WKWebsiteDataTypeEnum value; switch (type) { - case WKWebsiteDataTypes.cookies: - value = WKWebsiteDataTypesEnum.cookies; + case WKWebsiteDataType.cookies: + value = WKWebsiteDataTypeEnum.cookies; break; - case WKWebsiteDataTypes.memoryCache: - value = WKWebsiteDataTypesEnum.memoryCache; + case WKWebsiteDataType.memoryCache: + value = WKWebsiteDataTypeEnum.memoryCache; break; - case WKWebsiteDataTypes.diskCache: - value = WKWebsiteDataTypesEnum.diskCache; + case WKWebsiteDataType.diskCache: + value = WKWebsiteDataTypeEnum.diskCache; break; - case WKWebsiteDataTypes.offlineWebApplicationCache: - value = WKWebsiteDataTypesEnum.offlineWebApplicationCache; + case WKWebsiteDataType.offlineWebApplicationCache: + value = WKWebsiteDataTypeEnum.offlineWebApplicationCache; break; - case WKWebsiteDataTypes.localStroage: - value = WKWebsiteDataTypesEnum.localStroage; + case WKWebsiteDataType.localStorage: + value = WKWebsiteDataTypeEnum.localStorage; break; - case WKWebsiteDataTypes.sessionStorage: - value = WKWebsiteDataTypesEnum.sessionStorage; + case WKWebsiteDataType.sessionStorage: + value = WKWebsiteDataTypeEnum.sessionStorage; break; - case WKWebsiteDataTypes.sqlDatabases: - value = WKWebsiteDataTypesEnum.sqlDatabases; + case WKWebsiteDataType.webSQLDatabases: + value = WKWebsiteDataTypeEnum.webSQLDatabases; break; - case WKWebsiteDataTypes.indexedDBDatabases: - value = WKWebsiteDataTypesEnum.indexedDBDatabases; + case WKWebsiteDataType.indexedDBDatabases: + value = WKWebsiteDataTypeEnum.indexedDBDatabases; break; } - return WKWebsiteDataTypesEnumData(value: value); + return WKWebsiteDataTypeEnumData(value: value); }); } @@ -258,12 +258,12 @@ class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { /// Calls [removeDataOfTypes] with the ids of the provided object instances. Future removeDataOfTypesForInstances( WKWebsiteDataStore instance, - Set dataTypes, { + Set dataTypes, { required double secondsModifiedSinceEpoch, }) { return removeDataOfTypes( instanceManager.getInstanceId(instance)!, - _toWKWebsiteDataTypesEnumData(dataTypes).toList(), + _toWKWebsiteDataTypeEnumData(dataTypes).toList(), secondsModifiedSinceEpoch, ); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_cookie_manager.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_cookie_manager.dart index c73111d73fd0..46322319ae89 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_cookie_manager.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_cookie_manager.dart @@ -19,7 +19,7 @@ class WebKitCookieManager extends WebViewCookieManagerPlatform { @override Future clearCookies() async { return websiteDataStore.removeDataOfTypes( - {WKWebsiteDataTypes.cookies}, + {WKWebsiteDataType.cookies}, DateTime.fromMillisecondsSinceEpoch(0), ); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart index d63cbef71f9f..de295932d22b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart @@ -227,11 +227,11 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { @override Future clearCache() { return webView.configuration.websiteDataStore.removeDataOfTypes( - { - WKWebsiteDataTypes.memoryCache, - WKWebsiteDataTypes.diskCache, - WKWebsiteDataTypes.offlineWebApplicationCache, - WKWebsiteDataTypes.localStroage, + { + WKWebsiteDataType.memoryCache, + WKWebsiteDataType.diskCache, + WKWebsiteDataType.offlineWebApplicationCache, + WKWebsiteDataType.localStorage, }, DateTime.fromMillisecondsSinceEpoch(0), ); 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 509fa8e1f7dd..d2c268a94559 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -101,19 +101,19 @@ class WKAudiovisualMediaTypeEnumData { /// Mirror of WKWebsiteDataTypes. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. -enum WKWebsiteDataTypesEnum { +enum WKWebsiteDataTypeEnum { cookies, memoryCache, diskCache, offlineWebApplicationCache, - localStroage, + localStorage, sessionStorage, - sqlDatabases, + webSQLDatabases, indexedDBDatabases, } -class WKWebsiteDataTypesEnumData { - late WKWebsiteDataTypesEnum? value; +class WKWebsiteDataTypeEnumData { + late WKWebsiteDataTypeEnum? value; } /// Mirror of WKNavigationActionPolicy. @@ -232,7 +232,7 @@ abstract class WKWebsiteDataStoreHostApi { @async bool removeDataOfTypes( int instanceId, - List dataTypes, + List dataTypes, double secondsModifiedSinceEpoch, ); } @@ -335,7 +335,7 @@ abstract class WKUserContentControllerHostApi { /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @HostApi(dartHostTestHandler: 'TestWKPreferencesHostApi') abstract class WKPreferencesHostApi { - @ObjCSelector('createFromWebViewConfiguration:configurationIdentifier:') + @ObjCSelector('createFromWebViewConfigurationWithIdentifier:configurationIdentifier:') void createFromWebViewConfiguration( int instanceId, int configurationInstanceId, @@ -498,5 +498,6 @@ abstract class WKHttpCookieStoreHostApi { ); @ObjCSelector('setCookieForStoreWithIdentifier:cookie:') + @async void setCookie(int instanceId, NSHttpCookieData cookie); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index f4e72b8f14eb..0c81e4339b0c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -20,6 +20,8 @@ dependencies: sdk: flutter path: ^1.8.0 webview_flutter_platform_interface: ^1.8.0 + simple_ast: + path: ../../../../penguin/packages/simple_ast dev_dependencies: build_runner: ^2.1.5 @@ -30,3 +32,7 @@ dev_dependencies: mockito: ^5.1.0 pedantic: ^1.10.0 pigeon: ^3.0.3 + code_template_processor: + path: ../../../../penguin/packages/code_template_processor + simple_ast_generator: + path: ../../../../penguin/packages/simple_ast_generator 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 042ddedbd769..e128a62d34d9 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 @@ -18,78 +18,62 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _TestWKWebsiteDataStoreHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is WKWebsiteDataTypesEnumData) { + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return WKWebsiteDataTypesEnumData.decode(readValue(buffer)!); - - default: + case 128: + return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = - _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); void createDefaultDataStore(int instanceId); - Future removeDataOfTypes( - int instanceId, - List dataTypes, - double secondsModifiedSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes(int instanceId, List dataTypes, double secondsModifiedSinceEpoch); + static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_instanceId!); return {}; }); @@ -97,28 +81,20 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = - (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); final double? arg_secondsModifiedSinceEpoch = (args[2] as double?); - assert(arg_secondsModifiedSinceEpoch != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes( - arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); + assert(arg_secondsModifiedSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); return {'result': output}; }); } @@ -129,29 +105,24 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } - abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); List getContentOffset(int instanceId); void setBackgroundColor(int instanceId, int? value); void setOpaque(int instanceId, bool opaque); - static void setup(TestUIViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -159,18 +130,15 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_instanceId!, arg_value); return {}; @@ -179,21 +147,17 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_instanceId!, arg_opaque!); return {}; }); @@ -205,7 +169,6 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } - abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -213,25 +176,20 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int instanceId); void scrollBy(int instanceId, double x, double y); void setContentOffset(int instanceId, double x, double y); - static void setup(TestUIScrollViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -239,18 +197,15 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -258,24 +213,19 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -283,24 +233,19 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -316,48 +261,42 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = - _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); void create(int instanceId); void createFromWebView(int instanceId, int webViewInstanceId); void setAllowsInlineMediaPlayback(int instanceId, bool allow); - void setMediaTypesRequiringUserActionForPlayback( - int instanceId, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, - {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback(int instanceId, List types); + static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -365,22 +304,17 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -388,22 +322,17 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_instanceId!, arg_allow!); return {}; }); @@ -411,26 +340,18 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = - (args[1] as List?) - ?.cast(); - assert(arg_types != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_instanceId!, arg_types!); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = (args[1] as List?)?.cast(); + assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback(arg_instanceId!, arg_types!); return {}; }); } @@ -445,112 +366,91 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = - _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); - void addScriptMessageHandler( - int instanceId, int handlerInstanceid, String name); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void addScriptMessageHandler(int instanceId, int handlerInstanceid, String name); void removeScriptMessageHandler(int instanceId, String name); void removeAllScriptMessageHandlers(int instanceId); void addUserScript(int instanceId, WKUserScriptData userScript); void removeAllUserScripts(int instanceId); - static void setup(TestWKUserContentControllerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerInstanceid = (args[1] as int?); - assert(arg_handlerInstanceid != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerInstanceid != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_instanceId!, arg_handlerInstanceid!, arg_name!); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler(arg_instanceId!, arg_handlerInstanceid!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_instanceId!, arg_name!); return {}; }); @@ -558,19 +458,15 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_instanceId!); return {}; }); @@ -578,23 +474,17 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = - (args[1] as WKUserScriptData?); - assert(arg_userScript != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); + assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_instanceId!, arg_userScript!); return {}; }); @@ -602,19 +492,15 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_instanceId!); return {}; }); @@ -626,56 +512,43 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } - abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); void setJavaScriptEnabled(int instanceId, bool enabled); - static void setup(TestWKPreferencesHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_enabled!); return {}; }); @@ -687,28 +560,22 @@ abstract class TestWKPreferencesHostApi { class _TestWKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { const _TestWKScriptMessageHandlerHostApiCodec(); } - abstract class TestWKScriptMessageHandlerHostApi { - static const MessageCodec codec = - _TestWKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = _TestWKScriptMessageHandlerHostApiCodec(); void create(int instanceId); - static void setup(TestWKScriptMessageHandlerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -720,29 +587,23 @@ abstract class TestWKScriptMessageHandlerHostApi { class _TestWKNavigationDelegateHostApiCodec extends StandardMessageCodec { const _TestWKNavigationDelegateHostApiCodec(); } - abstract class TestWKNavigationDelegateHostApi { - static const MessageCodec codec = - _TestWKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = _TestWKNavigationDelegateHostApiCodec(); void create(int instanceId); void setDidFinishNavigation(int instanceId, int? functionInstanceId); - static void setup(TestWKNavigationDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -750,19 +611,15 @@ abstract class TestWKNavigationDelegateHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); final int? arg_functionInstanceId = (args[1] as int?); api.setDidFinishNavigation(arg_instanceId!, arg_functionInstanceId); return {}; @@ -779,46 +636,41 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestNSObjectHostApi { static const MessageCodec codec = _TestNSObjectHostApiCodec(); void dispose(int instanceId); - void addObserver(int instanceId, int observerInstanceId, String keyPath, - List options); + void addObserver(int instanceId, int observerInstanceId, String keyPath, List options); void removeObserver(int instanceId, int observerInstanceId, String keyPath); - static void setup(TestNSObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return {}; }); @@ -826,57 +678,42 @@ abstract class TestNSObjectHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = - (args[3] as List?) - ?.cast(); - assert(arg_options != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_instanceId!, arg_observerInstanceId!, - arg_keyPath!, arg_options!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = (args[3] as List?)?.cast(); + assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!, arg_options!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); return {}; }); } @@ -891,65 +728,72 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypesEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: - return WKWebsiteDataTypesEnumData.decode(readValue(buffer)!); - - default: + + case 135: + return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -971,25 +815,20 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int instanceId, bool allow); void setCustomUserAgent(int instanceId, String? userAgent); Future evaluateJavaScript(int instanceId, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_configurationInstanceId!); return {}; }); @@ -997,18 +836,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateInstanceId = (args[1] as int?); api.setUIDelegate(arg_instanceId!, arg_uiDelegateInstanceId); return {}; @@ -1017,39 +853,32 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateInstanceId = (args[1] as int?); - api.setNavigationDelegate( - arg_instanceId!, arg_navigationDelegateInstanceId); + api.setNavigationDelegate(arg_instanceId!, arg_navigationDelegateInstanceId); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return {'result': output}; }); @@ -1057,18 +886,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_instanceId!); return {'result': output}; }); @@ -1076,21 +902,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_instanceId!, arg_request!); return {}; }); @@ -1098,21 +920,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_instanceId!, arg_string!, arg_baseUrl); return {}; @@ -1121,24 +939,19 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_instanceId!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -1146,21 +959,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_instanceId!, arg_key!); return {}; }); @@ -1168,18 +977,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return {'result': output}; }); @@ -1187,18 +993,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return {'result': output}; }); @@ -1206,18 +1009,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return {}; }); @@ -1225,18 +1025,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return {}; }); @@ -1244,18 +1041,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return {}; }); @@ -1263,18 +1057,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return {'result': output}; }); @@ -1282,42 +1073,33 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_instanceId!, arg_allow!); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures(arg_instanceId!, arg_allow!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_instanceId!, arg_userAgent); return {}; @@ -1326,23 +1108,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_instanceId!, arg_javaScriptString!); + assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript(arg_instanceId!, arg_javaScriptString!); return {'result': output}; }); } @@ -1353,27 +1130,22 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } - abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int instanceId); - static void setup(TestWKUIDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -1389,80 +1161,68 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = - _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore( - int instanceId, int websiteDataStoreInstanceId); - void setCookie(int instanceId, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + void createFromWebsiteDataStore(int instanceId, int websiteDataStoreInstanceId); + Future setCookie(int instanceId, NSHttpCookieData cookie); + static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreInstanceId = (args[1] as int?); - assert(arg_websiteDataStoreInstanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_instanceId!, arg_websiteDataStoreInstanceId!); + assert(arg_websiteDataStoreInstanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore(arg_instanceId!, arg_websiteDataStoreInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); - api.setCookie(arg_instanceId!, arg_cookie!); + assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + await api.setCookie(arg_instanceId!, arg_cookie!); return {}; }); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart index 7bd208eeac05..b8552c5d8157 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart. +// in webview_flutter_wkwebview/test/src/foundation/foundation_test.dart. // Do not manually edit this file. import 'package:mockito/mockito.dart' as _i1; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index 908709c90134..c78527427360 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i4; 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 8564bf889c2f..193b750fb86d 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 @@ -95,21 +95,21 @@ void main() { expect( websiteDataStore.removeDataOfTypes( - {WKWebsiteDataTypes.cookies}, + {WKWebsiteDataType.cookies}, DateTime.fromMillisecondsSinceEpoch(5000), ), completion(true), ); - final List typeData = + final List typeData = verify(mockPlatformHostApi.removeDataOfTypes( instanceManager.getInstanceId(websiteDataStore), captureAny, 5.0, - )).captured.single.cast() - as List; + )).captured.single.cast() + as List; - expect(typeData.single.value, WKWebsiteDataTypesEnum.cookies); + expect(typeData.single.value, WKWebsiteDataTypeEnum.cookies); }); }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index d4f1fefc190c..39977d7c63f2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,12 +1,12 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. -import 'dart:async' as _i4; +import 'dart:async' as _i3; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_wkwebview/src/common/web_kit.pigeon.dart' - as _i3; + as _i4; import '../common/test_web_kit.pigeon.dart' as _i2; @@ -37,9 +37,10 @@ class MockTestWKHttpCookieStoreHostApi extends _i1.Mock [instanceId, websiteDataStoreInstanceId]), returnValueForMissingStub: null); @override - void setCookie(int? instanceId, _i3.NSHttpCookieData? cookie) => - super.noSuchMethod(Invocation.method(#setCookie, [instanceId, cookie]), - returnValueForMissingStub: null); + _i3.Future setCookie(int? instanceId, _i4.NSHttpCookieData? cookie) => + (super.noSuchMethod(Invocation.method(#setCookie, [instanceId, cookie]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i3.Future); } /// A class which mocks [TestWKNavigationDelegateHostApi]. @@ -149,7 +150,7 @@ class MockTestWKUserContentControllerHostApi extends _i1.Mock Invocation.method(#removeAllScriptMessageHandlers, [instanceId]), returnValueForMissingStub: null); @override - void addUserScript(int? instanceId, _i3.WKUserScriptData? userScript) => super + void addUserScript(int? instanceId, _i4.WKUserScriptData? userScript) => super .noSuchMethod(Invocation.method(#addUserScript, [instanceId, userScript]), returnValueForMissingStub: null); @override @@ -184,7 +185,7 @@ class MockTestWKWebViewConfigurationHostApi extends _i1.Mock returnValueForMissingStub: null); @override void setMediaTypesRequiringUserActionForPlayback( - int? instanceId, List<_i3.WKAudiovisualMediaTypeEnumData?>? types) => + int? instanceId, List<_i4.WKAudiovisualMediaTypeEnumData?>? types) => super.noSuchMethod( Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [instanceId, types]), @@ -225,7 +226,7 @@ class MockTestWKWebViewHostApi extends _i1.Mock Invocation.method(#getEstimatedProgress, [instanceId]), returnValue: 0.0) as double); @override - void loadRequest(int? instanceId, _i3.NSUrlRequestData? request) => + void loadRequest(int? instanceId, _i4.NSUrlRequestData? request) => super.noSuchMethod(Invocation.method(#loadRequest, [instanceId, request]), returnValueForMissingStub: null); @override @@ -278,12 +279,12 @@ class MockTestWKWebViewHostApi extends _i1.Mock Invocation.method(#setCustomUserAgent, [instanceId, userAgent]), returnValueForMissingStub: null); @override - _i4.Future evaluateJavaScript( + _i3.Future evaluateJavaScript( int? instanceId, String? javaScriptString) => (super.noSuchMethod( Invocation.method( #evaluateJavaScript, [instanceId, javaScriptString]), - returnValue: Future.value()) as _i4.Future); + returnValue: Future.value()) as _i3.Future); } /// A class which mocks [TestWKWebsiteDataStoreHostApi]. @@ -307,12 +308,12 @@ class MockTestWKWebsiteDataStoreHostApi extends _i1.Mock Invocation.method(#createDefaultDataStore, [instanceId]), returnValueForMissingStub: null); @override - _i4.Future removeDataOfTypes( + _i3.Future removeDataOfTypes( int? instanceId, - List<_i3.WKWebsiteDataTypesEnumData?>? dataTypes, + List<_i4.WKWebsiteDataTypeEnumData?>? dataTypes, double? secondsModifiedSinceEpoch) => (super.noSuchMethod( Invocation.method(#removeDataOfTypes, [instanceId, dataTypes, secondsModifiedSinceEpoch]), - returnValue: Future.value(false)) as _i4.Future); + returnValue: Future.value(false)) as _i3.Future); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart index 5238c0bb2c56..35d2890115db 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart @@ -39,12 +39,12 @@ void main() { test('clearCookies', () async { when(mockWebsiteDataStore.removeDataOfTypes( - {WKWebsiteDataTypes.cookies}, any)) + {WKWebsiteDataType.cookies}, any)) .thenAnswer((_) => Future.value(true)); expect(cookieManager.clearCookies(), completion(true)); when(mockWebsiteDataStore.removeDataOfTypes( - {WKWebsiteDataTypes.cookies}, any)) + {WKWebsiteDataType.cookies}, any)) .thenAnswer((_) => Future.value(false)); expect(cookieManager.clearCookies(), completion(false)); }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart index a85c57f7bdb3..8d7751da785f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart @@ -79,7 +79,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _FakeWKHttpCookieStore_0()) as _i2.WKHttpCookieStore); @override _i3.Future removeDataOfTypes( - Set<_i2.WKWebsiteDataTypes>? dataTypes, DateTime? since) => + Set<_i2.WKWebsiteDataType>? dataTypes, DateTime? since) => (super.noSuchMethod( Invocation.method(#removeDataOfTypes, [dataTypes, since]), returnValue: Future.value(false)) as _i3.Future); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart index 8c104bdb3ee2..2eadb7ffc462 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart @@ -771,11 +771,11 @@ void main() { await buildWidget(tester); when( mockWebsiteDataStore.removeDataOfTypes( - { - WKWebsiteDataTypes.memoryCache, - WKWebsiteDataTypes.diskCache, - WKWebsiteDataTypes.offlineWebApplicationCache, - WKWebsiteDataTypes.localStroage, + { + WKWebsiteDataType.memoryCache, + WKWebsiteDataType.diskCache, + WKWebsiteDataType.offlineWebApplicationCache, + WKWebsiteDataType.localStorage, }, DateTime.fromMillisecondsSinceEpoch(0), ), diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart index 1138d13f0c25..066f33a9774e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart @@ -434,7 +434,7 @@ class MockWKWebsiteDataStore extends _i1.Mock returnValue: _FakeWKHttpCookieStore_6()) as _i3.WKHttpCookieStore); @override _i5.Future removeDataOfTypes( - Set<_i3.WKWebsiteDataTypes>? dataTypes, DateTime? since) => + Set<_i3.WKWebsiteDataType>? dataTypes, DateTime? since) => (super.noSuchMethod( Invocation.method(#removeDataOfTypes, [dataTypes, since]), returnValue: Future.value(false)) as _i5.Future); From cdd76b059007e8d7c4468f82a483c413ed7f2c7c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 09:43:29 -0700 Subject: [PATCH 02/23] compiles again --- .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 4 +-- .../ios/Classes/FWFGeneratedWebKitApis.m | 8 +++--- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 8 ++++-- .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 27 ++++++++++++++++--- .../pigeons/web_kit.dart | 4 +-- 6 files changed, 38 insertions(+), 15 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index c48b313daec2..6ea4e699ed20 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 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 c9243fc42a01..90fa5ee06ccd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -147,9 +147,9 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createDataStoreFromConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; - (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes secondsModifiedSinceEpoch:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); 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 dc59abd2b899..9bb410e8386c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -276,13 +276,13 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge binaryMessenger:binaryMessenger codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createDataStoreFromConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; } @@ -317,13 +317,13 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge binaryMessenger:binaryMessenger codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:secondsModifiedSinceEpoch:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:secondsModifiedSinceEpoch:completion:)", api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes secondsModifiedSinceEpoch:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m index 7a195845263a..e4218c7a4a4e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -33,7 +33,9 @@ - (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)instanceId [self.instanceManager addInstance:dataStore.httpCookieStore withIdentifier:instanceId.longValue]; } else { - // Fallback on earlier versions + *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" + message:@"setCookie is only supported on versions 11+." + details:nil]; } } @@ -47,7 +49,9 @@ - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId cookie:(n } ]; } else { - // Fallback on earlier versions + completion([FlutterError errorWithCode:@"FWFUnsupportedVersionError" + message:@"setCookie is only supported on versions 11+." + details:nil]); } } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m index d5574ddeb43d..bd94c897c084 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -30,11 +30,30 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc [self.instanceManager addInstance:configuration.websiteDataStore withIdentifier:instanceId.longValue]; } +- (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + [self.instanceManager addInstance:[WKWebsiteDataStore defaultDataStore] withIdentifier:instanceId.longValue]; +} - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - dataTypes:(nonnull NSArray *)dataTypes - since:(nonnull NSNumber *)since - error:(FlutterError *_Nullable *_Nonnull) error { - return [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes:dataTypes since:since]; + ofTypes:(nonnull NSArray *)dataTypes + modifiedSince:(nonnull NSNumber *)secondsModifiedSinceEpoch + completion:(nonnull void (^)(NSNumber * _Nullable, FlutterError * _Nullable))completion { + NSMutableSet *stringDataTypes = [NSMutableSet set]; + for (FWFWKWebsiteDataTypeEnumData *type in dataTypes) { + [stringDataTypes addObject:FWFWKWebsiteDataTypeFromEnumData(type)]; + } + + WKWebsiteDataStore *dataStore =[self websiteDataStoreForIdentifier:instanceId]; + [dataStore fetchDataRecordsOfTypes:stringDataTypes completionHandler:^(NSArray *records) { + [dataStore removeDataOfTypes:stringDataTypes + modifiedSince:[NSDate dateWithTimeIntervalSince1970:secondsModifiedSinceEpoch.doubleValue] + completionHandler:^{ + if (records.count > 0) { + completion(@YES, nil); + } else { + completion(@NO, nil); + } + }]; + }]; } @end 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 d2c268a94559..3c8e1fa5ae23 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -216,7 +216,7 @@ class NSHttpCookieData { @HostApi(dartHostTestHandler: 'TestWKWebsiteDataStoreHostApi') abstract class WKWebsiteDataStoreHostApi { @ObjCSelector( - 'createDataStoreFromConfigurationWithIdentifier:configurationIdentifier:', + 'createFromWebViewConfigurationWithIdentifier:configurationIdentifier:', ) void createFromWebViewConfiguration( int instanceId, @@ -227,7 +227,7 @@ abstract class WKWebsiteDataStoreHostApi { void createDefaultDataStore(int instanceId); @ObjCSelector( - 'removeDataFromDataStoreWithIdentifier:ofTypes:secondsModifiedSinceEpoch:', + 'removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:', ) @async bool removeDataOfTypes( From 56351eaafcc7f4e8f506fbcb1aecc3e61e261f42 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 11:04:45 -0700 Subject: [PATCH 03/23] working tests --- .../ios/Runner.xcodeproj/project.pbxproj | 18 ++- .../FWFHTTPCookieStoreHostApiTests.m | 40 ++++++ .../RunnerTests/FWFPreferencesHostApiTests.m | 40 ++++++ .../FWFWebViewConfigurationHostApiTests.m | 62 ++++++++ .../FWFWebsiteDataStoreHostApiTests.m | 46 ++++++ .../webview_flutter_wkwebview/go.sh | 1 + .../ios/Classes/FWFGeneratedWebKitApis.h | 2 +- .../ios/Classes/FWFGeneratedWebKitApis.m | 4 +- .../Classes/FWFWebViewConfigurationHostApi.m | 4 +- .../lib/src/web_kit/data_output.h | 8 +- .../lib/src/web_kit/output_test.m | 136 ++++++++++-------- .../lib/src/web_kit/template_test.m | 20 +-- .../pigeons/web_kit.dart | 5 +- 13 files changed, 307 insertions(+), 79 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 6ea4e699ed20..b25ededc20d0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -14,6 +14,10 @@ 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */; }; 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */; }; 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */; }; + 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B662820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m */; }; + 8FB79B6928204E8700C101D3 /* FWFPreferencesHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */; }; + 8FB79B6B28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */; }; + 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -73,6 +77,10 @@ 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFInstanceManagerTests.m; sourceTree = ""; }; 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewHostApiTests.m; sourceTree = ""; }; 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFDataConvertersTests.m; sourceTree = ""; }; + 8FB79B662820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFHTTPCookieStoreHostApiTests.m; sourceTree = ""; }; + 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFPreferencesHostApiTests.m; sourceTree = ""; }; + 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebsiteDataStoreHostApiTests.m; sourceTree = ""; }; + 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewConfigurationHostApiTests.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -135,6 +143,10 @@ 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */, 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */, 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */, + 8FB79B662820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m */, + 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */, + 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */, + 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -433,11 +445,15 @@ buildActionMask = 2147483647; files = ( 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */, + 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */, 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */, 334734012669319100DCC49E /* FLTWebViewTests.m in Sources */, + 8FB79B6B28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m in Sources */, 334734022669319400DCC49E /* FLTWKNavigationDelegateTests.m in Sources */, 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */, + 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */, E43693B527512C0F00382F85 /* FLTCookieManagerTests.m in Sources */, + 8FB79B6928204E8700C101D3 /* FWFPreferencesHostApiTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m new file mode 100644 index 000000000000..5d9a08e027de --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -0,0 +1,40 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFHTTPCookieStoreHostApiTests : XCTestCase +@end + +@implementation FWFHTTPCookieStoreHostApiTests + +- (void)testSetCookie API_AVAILABLE(ios(11.0)) { + WKHTTPCookieStore *mockHttpCookieStore = OCMClassMock([WKHTTPCookieStore class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockHttpCookieStore withIdentifier:0]; + + FWFHTTPCookieStoreHostApiImpl *hostApi = + [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData makeWithProperties:@{ + [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName]:@"hello" + }]; + FlutterError *__block blockError; + [hostApi setCookieForStoreWithIdentifier:@0 + cookie:cookieData + completion:^(FlutterError *error) { + blockError = error; + }]; + OCMVerify([mockHttpCookieStore setCookie:[NSHTTPCookie cookieWithProperties:@{ + NSHTTPCookieName: @"hello" + }] completionHandler:OCMOCK_ANY]); + XCTAssertNil(blockError); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m new file mode 100644 index 000000000000..d52058e12dab --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -0,0 +1,40 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFPreferencesHostApiTests : XCTestCase +@end + +@implementation FWFPreferencesHostApiTests + +- (void)testSetJavaScriptEnabled { + WKPreferences *mockPreferences = OCMClassMock([WKPreferences class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockPreferences withIdentifier:0]; + + FWFPreferencesHostApiImpl *hostApi = + [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 + + isEnabled:@YES + + error:&error]; + OCMVerify([mockPreferences setJavaScriptEnabled + + :YES + + + ]); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m new file mode 100644 index 000000000000..c2bb9d5f1896 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -0,0 +1,62 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFWebViewConfigurationHostApiTests : XCTestCase +@end + +@implementation FWFWebViewConfigurationHostApiTests + +- (void)testSetAllowsInlineMediaPlayback { + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([WKWebViewConfiguration class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; + + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 + + isAllowed:@NO + + error:&error]; + OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback + + :NO + + + ]); + XCTAssertNil(error); +} + +- (void)testSetMediaTypesRequiringUserActionForPlayback { + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([WKWebViewConfiguration class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; + + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 + forTypes:@[[FWFWKAudiovisualMediaTypeEnumData makeWithValue:FWFWKAudiovisualMediaTypeEnumAudio], [FWFWKAudiovisualMediaTypeEnumData makeWithValue:FWFWKAudiovisualMediaTypeEnumVideo]] + error:&error]; + OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback + + :(WKAudiovisualMediaTypeAudio | WKAudiovisualMediaTypeVideo) + + + ]); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m new file mode 100644 index 000000000000..9ac70dcd795d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -0,0 +1,46 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFWebsiteDataStoreHostApiTests : XCTestCase +@end + +@implementation FWFWebsiteDataStoreHostApiTests + +- (void)testRemoveDataOfTypes { + WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([WKWebsiteDataStore class]); + + WKWebsiteDataRecord *mockDataRecord = OCMClassMock([WKWebsiteDataRecord class]); + OCMStub([mockWebsiteDataStore + fetchDataRecordsOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] + completionHandler:([OCMArg invokeBlockWithArgs:@[mockDataRecord], nil])]); + + OCMStub([mockWebsiteDataStore + removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] modifiedSince:[NSDate dateWithTimeIntervalSince1970:45.0] completionHandler:([OCMArg invokeBlock])]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; + + FWFWebsiteDataStoreHostApiImpl *hostApi = + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + NSNumber __block *returnValue; + FlutterError *__block blockError; + [hostApi removeDataFromDataStoreWithIdentifier:@0 + ofTypes:@[[FWFWKWebsiteDataTypeEnumData makeWithValue:FWFWKWebsiteDataTypeEnumLocalStorage]] + modifiedSince:@45.0 + completion:^(NSNumber *result, FlutterError *error) { + returnValue = result; + blockError = error; + }]; + XCTAssertEqualObjects(returnValue, @YES); + XCTAssertNil(blockError); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/go.sh b/packages/webview_flutter/webview_flutter_wkwebview/go.sh index 652603e43c42..402f61bdc788 100755 --- a/packages/webview_flutter/webview_flutter_wkwebview/go.sh +++ b/packages/webview_flutter/webview_flutter_wkwebview/go.sh @@ -3,3 +3,4 @@ flutter pub run code_template_processor --template-file lib/src/web_kit/template flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m 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 90fa5ee06ccd..e466d5e92363 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -185,7 +185,7 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; - (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAlowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; - (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 9bb410e8386c..2a84c0c5488c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -650,13 +650,13 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess binaryMessenger:binaryMessenger codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:error:)", api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAlowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m index 45a2df72f6aa..a1fbd4f4e4e4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -37,9 +37,9 @@ - (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId } - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - isAlowed:(nonnull NSNumber *)allow + isAllowed:(nonnull NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull) error { - [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback:allow]; + [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback:allow.boolValue]; } - (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h index deab281506ce..e3282d859ace 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h @@ -6,7 +6,7 @@ * * @return An NSKeyValueObservingOptions or -1 if data could not be converted. */ -extern NSUInteger FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); /** * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. @@ -15,7 +15,7 @@ extern NSUInteger FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservi * * @return An NSKeyValueChange or -1 if data could not be converted. */ -extern NSUInteger FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data); +extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data); /** * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. @@ -24,7 +24,7 @@ extern NSUInteger FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *d * * @return An NSKeyValueChangeKey or -1 if data could not be converted. */ -extern NSUInteger FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data); +extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data); /** * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. @@ -33,4 +33,4 @@ extern NSUInteger FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumD * * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. */ -extern NSUInteger FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); +extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m index 972ede99c9f2..e2fbb6cab52c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m @@ -15,10 +15,13 @@ @interface FWFPreferencesHostApiTests : XCTestCase @implementation FWFPreferencesHostApiTests - (void)testSetJavaScriptEnabled { - FWFWebView *mockPreferences = OCMClassMock([ + + WKPreferences + *mockPreferences = OCMClassMock([ - setJavaScriptEnabled + + WKPreferences class]); @@ -29,13 +32,12 @@ - (void)testSetJavaScriptEnabled { [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setJavaScriptEnabledForPreferencesWithIdentifier - - :aValue + [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 + enabled:aValue error:&error]; - OCMVerify([mockWebView setJavaScriptEnabled: + OCMVerify([mockPreferences setJavaScriptEnabled :aValue @@ -62,10 +64,13 @@ @interface FWFWebsiteDataStoreHostApiTests : XCTestCase @implementation FWFWebsiteDataStoreHostApiTests - (void)testRemoveDataOfTypes { - FWFWebView *mockWebsiteDataStore = OCMClassMock([ + + + WKWebsiteDataStore + *mockWebsiteDataStore = OCMClassMock([ - removeDataOfTypes + WKWebsiteDataStore class]); @@ -76,15 +81,14 @@ - (void)testRemoveDataOfTypes { [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeDataFromDataStoreWithIdentifier - - :aValue + [hostApi removeDataFromDataStoreWithIdentifier:@0 + dataTypes:aValue since:aValue error:&error]; - OCMVerify([mockWebView removeDataOfTypes: + OCMVerify([mockWebsiteDataStore removeDataOfTypes :aValue @@ -113,10 +117,13 @@ @interface FWFHttpCookieStoreHostApiTests : XCTestCase @implementation FWFHttpCookieStoreHostApiTests - (void)testSetCookie { - FWFWebView *mockHttpCookieStore = OCMClassMock([ + + WKHttpCookieStore + *mockHttpCookieStore = OCMClassMock([ - setCookie + + WKHttpCookieStore class]); @@ -127,13 +134,12 @@ - (void)testSetCookie { [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setCookieForStoreWithIdentifier - - :aValue + [hostApi setCookieForStoreWithIdentifier:@0 + cookie:aValue error:&error]; - OCMVerify([mockWebView setCookie: + OCMVerify([mockHttpCookieStore setCookie :aValue @@ -177,10 +183,13 @@ @interface FWFUserContentControllerHostApiTests : XCTestCase @implementation FWFUserContentControllerHostApiTests - (void)testAddScriptMessageHandler { - FWFWebView *mockUserContentController = OCMClassMock([ + + + WKUserContentController + *mockUserContentController = OCMClassMock([ - addScriptMessageHandler + WKUserContentController class]); @@ -191,15 +200,14 @@ - (void)testAddScriptMessageHandler { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi addScriptMessageHandlerForControllerWithIdentifier - - :aValue + [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 + handler:aValue name:aValue error:&error]; - OCMVerify([mockWebView addScriptMessageHandler: + OCMVerify([mockUserContentController addScriptMessageHandler :aValue @@ -211,10 +219,13 @@ - (void)testAddScriptMessageHandler { } - (void)testRemoveScriptMessageHandler { - FWFWebView *mockUserContentController = OCMClassMock([ + + WKUserContentController + *mockUserContentController = OCMClassMock([ - removeScriptMessageHandler + + WKUserContentController class]); @@ -225,13 +236,12 @@ - (void)testRemoveScriptMessageHandler { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeScriptMessageHandlerForControllerWithIdentifier - - :aValue + [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 + name:aValue error:&error]; - OCMVerify([mockWebView removeScriptMessageHandler: + OCMVerify([mockUserContentController removeScriptMessageHandler :aValue @@ -241,10 +251,13 @@ - (void)testRemoveScriptMessageHandler { } - (void)testRemoveAllScriptMessageHandlers { - FWFWebView *mockUserContentController = OCMClassMock([ + + + WKUserContentController + *mockUserContentController = OCMClassMock([ - removeAllScriptMessageHandlers + WKUserContentController class]); @@ -255,11 +268,10 @@ - (void)testRemoveAllScriptMessageHandlers { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier - + [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 error:&error]; - OCMVerify([mockWebView removeAllScriptMessageHandlers: + OCMVerify([mockUserContentController removeAllScriptMessageHandlers ]); @@ -267,10 +279,13 @@ - (void)testRemoveAllScriptMessageHandlers { } - (void)testAddUserScript { - FWFWebView *mockUserContentController = OCMClassMock([ + + + WKUserContentController + *mockUserContentController = OCMClassMock([ - addUserScript + WKUserContentController class]); @@ -281,13 +296,12 @@ - (void)testAddUserScript { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi addUserScriptForControllerWithIdentifier - - :aValue + [hostApi addUserScriptForControllerWithIdentifier:@0 + userScript:aValue error:&error]; - OCMVerify([mockWebView addUserScript: + OCMVerify([mockUserContentController addUserScript :aValue @@ -297,10 +311,13 @@ - (void)testAddUserScript { } - (void)testRemoveAllUserScripts { - FWFWebView *mockUserContentController = OCMClassMock([ + + + WKUserContentController + *mockUserContentController = OCMClassMock([ - removeAllUserScripts + WKUserContentController class]); @@ -311,11 +328,10 @@ - (void)testRemoveAllUserScripts { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeAllUserScriptsForControllerWithIdentifier - + [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 error:&error]; - OCMVerify([mockWebView removeAllUserScripts: + OCMVerify([mockUserContentController removeAllUserScripts ]); @@ -340,10 +356,13 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @implementation FWFWebViewConfigurationHostApiTests - (void)testSetAllowsInlineMediaPlayback { - FWFWebView *mockWebViewConfiguration = OCMClassMock([ + + + WKWebViewConfiguration + *mockWebViewConfiguration = OCMClassMock([ - setAllowsInlineMediaPlayback + WKWebViewConfiguration class]); @@ -354,13 +373,12 @@ - (void)testSetAllowsInlineMediaPlayback { [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier - - :aValue + [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 + allow:aValue error:&error]; - OCMVerify([mockWebView setAllowsInlineMediaPlayback: + OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback :aValue @@ -370,10 +388,13 @@ - (void)testSetAllowsInlineMediaPlayback { } - (void)testSetMediaTypesRequiringUserActionForPlayback { - FWFWebView *mockWebViewConfiguration = OCMClassMock([ + + WKWebViewConfiguration + *mockWebViewConfiguration = OCMClassMock([ - setMediaTypesRequiringUserActionForPlayback + + WKWebViewConfiguration class]); @@ -384,13 +405,12 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier - - :aValue + [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 + types:aValue error:&error]; - OCMVerify([mockWebView setMediaTypesRequiringUserActionForPlayback: + OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback :aValue diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m index ed426c3bb6e9..99fdc431f11b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m @@ -15,12 +15,17 @@ @interface FWF__customValues_nameWithoutPrefix__HostApiTests : XCTestCase @implementation FWF__customValues_nameWithoutPrefix__HostApiTests /*iterate methods method*/ - (void)test/*replace :case=pascal name*/methodName/**/ { - FWFWebView *mock__class_customValues_nameWithoutPrefix__ = OCMClassMock([ /*if class_customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ + FWF__class_customValues_nameWithoutPrefix__ + /**/ + /*if! class_customValues_isProtocol*/ + __class_name__ + /**/ *mock__class_customValues_nameWithoutPrefix__ = OCMClassMock([ + /*if class_customValues_isProtocol*/ + FWF__class_customValues_nameWithoutPrefix__ /**/ /*if! class_customValues_isProtocol*/ - __name__ + __class_name__ /**/ class]); @@ -31,15 +36,12 @@ - (void)test/*replace :case=pascal name*/methodName/**/ { [[FWF__class_customValues_nameWithoutPrefix__HostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi __customValues_objcName__ - /*iterate :end=1 parameters parameter*/ - :aValue - /**/ - /*iterate :start=1 parameters parameter*/ + [hostApi __customValues_objcName__:@0 + /*iterate parameters parameter*/ __name__:aValue /**/ error:&error]; - OCMVerify([mockWebView __name__: + OCMVerify([mock__class_customValues_nameWithoutPrefix__ __name__ /*iterate :end=1 parameters parameter*/ :aValue /**/ 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 3c8e1fa5ae23..c6fb23f7120d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -282,7 +282,7 @@ abstract class WKWebViewConfigurationHostApi { void createFromWebView(int instanceId, int webViewInstanceId); @ObjCSelector( - 'setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAlowed:', + 'setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:', ) void setAllowsInlineMediaPlayback(int instanceId, bool allow); @@ -335,7 +335,8 @@ abstract class WKUserContentControllerHostApi { /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @HostApi(dartHostTestHandler: 'TestWKPreferencesHostApi') abstract class WKPreferencesHostApi { - @ObjCSelector('createFromWebViewConfigurationWithIdentifier:configurationIdentifier:') + @ObjCSelector( + 'createFromWebViewConfigurationWithIdentifier:configurationIdentifier:') void createFromWebViewConfiguration( int instanceId, int configurationInstanceId, From d045afc550af8ae301ecd2858505da7e46cdbb6e Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 11:07:33 -0700 Subject: [PATCH 04/23] formatting --- .../FWFHTTPCookieStoreHostApiTests.m | 12 +- .../RunnerTests/FWFPreferencesHostApiTests.m | 13 +- .../FWFWebViewConfigurationHostApiTests.m | 38 +- .../FWFWebsiteDataStoreHostApiTests.m | 23 +- .../ios/Classes/FWFDataConverters.h | 17 +- .../ios/Classes/FWFDataConverters.m | 58 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 273 +++- .../ios/Classes/FWFGeneratedWebKitApis.m | 1314 ++++++++++------- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 24 +- .../ios/Classes/FWFPreferencesHostApi.m | 12 +- .../Classes/FWFWebViewConfigurationHostApi.m | 34 +- .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 54 +- .../ios/Classes/webview-umbrella.h | 8 +- .../lib/src/common/web_kit.pigeon.dart | 751 ++++++---- .../lib/src/web_kit/data_output.h | 27 +- .../lib/src/web_kit/data_output.m | 76 +- .../lib/src/web_kit/data_template.h | 2 +- .../lib/src/web_kit/data_template.m | 10 +- .../lib/src/web_kit/output.h | 20 +- .../lib/src/web_kit/output.m | 458 +++--- .../lib/src/web_kit/output_test.m | 190 +-- .../lib/src/web_kit/template.h | 2 +- .../lib/src/web_kit/template.m | 82 +- .../lib/src/web_kit/template_test.m | 27 +- .../test/src/common/test_web_kit.pigeon.dart | 830 +++++++---- 25 files changed, 2520 insertions(+), 1835 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 5d9a08e027de..9fb31b2ceb8d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -23,17 +23,17 @@ - (void)testSetCookie API_AVAILABLE(ios(11.0)) { [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData makeWithProperties:@{ - [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName]:@"hello" + [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] : @"hello" }]; FlutterError *__block blockError; [hostApi setCookieForStoreWithIdentifier:@0 cookie:cookieData completion:^(FlutterError *error) { - blockError = error; - }]; - OCMVerify([mockHttpCookieStore setCookie:[NSHTTPCookie cookieWithProperties:@{ - NSHTTPCookieName: @"hello" - }] completionHandler:OCMOCK_ANY]); + blockError = error; + }]; + OCMVerify([mockHttpCookieStore + setCookie:[NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"hello"}] + completionHandler:OCMOCK_ANY]); XCTAssertNil(blockError); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index d52058e12dab..31fa36849253 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -23,16 +23,11 @@ - (void)testSetJavaScriptEnabled { [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 - - isEnabled:@YES - - error:&error]; + [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 isEnabled:@YES error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled - - :YES - - + +:YES + ]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index c2bb9d5f1896..2201f8c584a5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -24,15 +24,14 @@ - (void)testSetAllowsInlineMediaPlayback { FlutterError *error; [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - - isAllowed:@NO - - error:&error]; + + isAllowed:@NO + + error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback - - :NO - - + +:NO + ]); XCTAssertNil(error); } @@ -47,15 +46,20 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 - forTypes:@[[FWFWKAudiovisualMediaTypeEnumData makeWithValue:FWFWKAudiovisualMediaTypeEnumAudio], [FWFWKAudiovisualMediaTypeEnumData makeWithValue:FWFWKAudiovisualMediaTypeEnumVideo]] - error:&error]; - OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback - - :(WKAudiovisualMediaTypeAudio | WKAudiovisualMediaTypeVideo) - - - ]); + [hostApi + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 + forTypes:@[ + [FWFWKAudiovisualMediaTypeEnumData + makeWithValue: + FWFWKAudiovisualMediaTypeEnumAudio], + [FWFWKAudiovisualMediaTypeEnumData + makeWithValue: + FWFWKAudiovisualMediaTypeEnumVideo] + ] + error:&error]; + OCMVerify([mockWebViewConfiguration + setMediaTypesRequiringUserActionForPlayback:(WKAudiovisualMediaTypeAudio | + WKAudiovisualMediaTypeVideo)]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index 9ac70dcd795d..2c868288e6ba 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -15,14 +15,16 @@ @implementation FWFWebsiteDataStoreHostApiTests - (void)testRemoveDataOfTypes { WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([WKWebsiteDataStore class]); - + WKWebsiteDataRecord *mockDataRecord = OCMClassMock([WKWebsiteDataRecord class]); OCMStub([mockWebsiteDataStore - fetchDataRecordsOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] - completionHandler:([OCMArg invokeBlockWithArgs:@[mockDataRecord], nil])]); - + fetchDataRecordsOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] + completionHandler:([OCMArg invokeBlockWithArgs:@[ mockDataRecord ], nil])]); + OCMStub([mockWebsiteDataStore - removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] modifiedSince:[NSDate dateWithTimeIntervalSince1970:45.0] completionHandler:([OCMArg invokeBlock])]); + removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeLocalStorage] + modifiedSince:[NSDate dateWithTimeIntervalSince1970:45.0] + completionHandler:([OCMArg invokeBlock])]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; @@ -33,12 +35,15 @@ - (void)testRemoveDataOfTypes { NSNumber __block *returnValue; FlutterError *__block blockError; [hostApi removeDataFromDataStoreWithIdentifier:@0 - ofTypes:@[[FWFWKWebsiteDataTypeEnumData makeWithValue:FWFWKWebsiteDataTypeEnumLocalStorage]] + ofTypes:@[ + [FWFWKWebsiteDataTypeEnumData + makeWithValue:FWFWKWebsiteDataTypeEnumLocalStorage] + ] modifiedSince:@45.0 completion:^(NSNumber *result, FlutterError *error) { - returnValue = result; - blockError = error; - }]; + returnValue = result; + blockError = error; + }]; XCTAssertEqualObjects(returnValue, @YES); XCTAssertNil(blockError); } 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 eaf656205b2a..1f5844573426 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -16,8 +16,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return An NSURLRequest or nil if data could not be converted. */ -extern NSURLRequest* _Nullable FWFNSURLRequestFromRequestData( - FWFNSUrlRequestData* data); +extern NSURLRequest *_Nullable FWFNSURLRequestFromRequestData(FWFNSUrlRequestData *data); /** * Converts an FWFNSHttpCookieData to an NSHTTPCookie. @@ -26,7 +25,7 @@ extern NSURLRequest* _Nullable FWFNSURLRequestFromRequestData( * * @return An NSHTTPCookie or nil if data could not be converted. */ -extern NSHTTPCookie* _Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData* data); +extern NSHTTPCookie *_Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData *data); /** * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. @@ -35,7 +34,8 @@ extern NSHTTPCookie* _Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData * * @return An NSKeyValueObservingOptions or -1 if data could not be converted. */ -extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData *data); /** * Converts an FWFNSHTTPCookiePropertyKeyEnumData to an NSHTTPCookiePropertyKey. @@ -44,7 +44,8 @@ extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFN * * @return An NSHttpCookiePropertyKey or nil if data could not be converted. */ -extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); +extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData *data); /** * Converts an FWFWKUserScriptInjectionTimeEnumData to a WKUserScriptInjectionTime. @@ -53,7 +54,8 @@ extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( * * @return An WKUserScriptInjectionTime or -1 if data could not be converted. */ -extern WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData(FWFWKUserScriptInjectionTimeEnumData *data); +extern WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData( + FWFWKUserScriptInjectionTimeEnumData *data); /** * Converts an FWFWKAudiovisualMediaTypeEnumData to an WKAudiovisualMediaTypes. @@ -63,7 +65,8 @@ extern WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData(FWFWKU * @return An WKAudiovisualMediaType or -1 if data could not be converted. */ API_AVAILABLE(ios(10.0)) -extern WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(FWFWKAudiovisualMediaTypeEnumData *data); +extern WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData( + FWFWKAudiovisualMediaTypeEnumData *data); /** * Converts an FWFWKWebsiteDataTypeEnumData to a WKWebsiteDataType. 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 8402a067e7eb..2affad706632 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -24,9 +24,9 @@ return request; } -extern NSHTTPCookie* _Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData* data) { +extern NSHTTPCookie *_Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData *data) { NSMutableDictionary *properties = [NSMutableDictionary dictionary]; - for (FWFNSHttpCookiePropertyKeyEnumData* key in data.properties.allKeys) { + for (FWFNSHttpCookiePropertyKeyEnumData *key in data.properties.allKeys) { NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(key); if (!cookieKey) { return nil; @@ -36,9 +36,9 @@ return [NSHTTPCookie cookieWithProperties:properties]; } - -NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { - switch(data.value) { +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData *data) { + switch (data.value) { case FWFNSKeyValueObservingOptionsEnumNewValue: return NSKeyValueObservingOptionNew; case FWFNSKeyValueObservingOptionsEnumOldValue: @@ -48,12 +48,13 @@ NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyVal case FWFNSKeyValueObservingOptionsEnumPriorNotification: return NSKeyValueObservingOptionPrior; } - + return -1; } -NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { - switch(data.value) { +NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData *data) { + switch (data.value) { case FWFNSHttpCookiePropertyKeyEnumComment: return NSHTTPCookieComment; case FWFNSHttpCookiePropertyKeyEnumCommentUrl: @@ -88,41 +89,41 @@ NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData(FWFNSHt case FWFNSHttpCookiePropertyKeyEnumVersion: return NSHTTPCookieVersion; } - + return nil; } - -WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData(FWFWKUserScriptInjectionTimeEnumData *data) { - switch(data.value) { +WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData( + FWFWKUserScriptInjectionTimeEnumData *data) { + switch (data.value) { case FWFWKUserScriptInjectionTimeEnumAtDocumentStart: return WKUserScriptInjectionTimeAtDocumentStart; case FWFWKUserScriptInjectionTimeEnumAtDocumentEnd: return WKUserScriptInjectionTimeAtDocumentEnd; } - + return -1; } API_AVAILABLE(ios(10.0)) -WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(FWFWKAudiovisualMediaTypeEnumData *data) { - switch(data.value) { - case FWFWKAudiovisualMediaTypeEnumNone: - return WKAudiovisualMediaTypeNone; - case FWFWKAudiovisualMediaTypeEnumAudio: - return WKAudiovisualMediaTypeAudio; - case FWFWKAudiovisualMediaTypeEnumVideo: - return WKAudiovisualMediaTypeVideo; - case FWFWKAudiovisualMediaTypeEnumAll: - return WKAudiovisualMediaTypeAll; - } - - +WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData( + FWFWKAudiovisualMediaTypeEnumData *data) { + switch (data.value) { + case FWFWKAudiovisualMediaTypeEnumNone: + return WKAudiovisualMediaTypeNone; + case FWFWKAudiovisualMediaTypeEnumAudio: + return WKAudiovisualMediaTypeAudio; + case FWFWKAudiovisualMediaTypeEnumVideo: + return WKAudiovisualMediaTypeVideo; + case FWFWKAudiovisualMediaTypeEnumAll: + return WKAudiovisualMediaTypeAll; + } + return -1; } NSString *_Nullable FWFWKWebsiteDataTypeFromEnumData(FWFWKWebsiteDataTypeEnumData *data) { - switch(data.value) { + switch (data.value) { case FWFWKWebsiteDataTypeEnumCookies: return WKWebsiteDataTypeCookies; case FWFWKWebsiteDataTypeEnumMemoryCache: @@ -140,7 +141,6 @@ WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(FWFWKAudiovisualMe case FWFWKWebsiteDataTypeEnumIndexedDBDatabases: return WKWebsiteDataTypeIndexedDBDatabases; } - + return nil; } - 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 e466d5e92363..2157088a47d5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -116,104 +116,170 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString * url; -@property(nonatomic, copy, nullable) NSString * httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; -@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString *url; +@property(nonatomic, copy, nullable) NSString *httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; +@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString * source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; -@property(nonatomic, strong) NSNumber * isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString *source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; +@property(nonatomic, strong) NSNumber *isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProperties:(NSDictionary *)properties; -@property(nonatomic, strong) NSDictionary * properties; ++ (instancetype)makeWithProperties: + (NSDictionary *)properties; +@property(nonatomic, strong) + NSDictionary *properties; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId + ofTypes:(NSArray *)dataTypes + modifiedSince:(NSNumber *)secondsModifiedSinceEpoch + completion:(void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId + toValue:(nullable NSNumber *)value + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId + isOpaque:(NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId + forTypes: + (NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error; @end -extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + handlerIdentifier:(NSNumber *)handlerInstanceid + ofName:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + name:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId + userScript:(FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId + isEnabled:(NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -222,71 +288,126 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId + functionIdentifier:(nullable NSNumber *)functionInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + URL:(nullable NSString *)url + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + options: + (NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier: + (nullable NSNumber *)navigationDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId + request:(FWFNSUrlRequestData *)request + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId + HTMLString:(NSString *)string + baseURL:(nullable NSString *)baseUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId + fileURL:(NSString *)url + readAccessURL:(NSString *)readAccessUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId + assetKey:(NSString *)key + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId + javaScriptString:(NSString *)javaScriptString + completion:(void (^)(id _Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -295,16 +416,22 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId + dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId + cookie:(FWFNSHttpCookieData *)cookie + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 2a84c0c5488c..41fa87e04713 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,26 +14,25 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code": (error.code ? error.code : [NSNull null]), - @"message": (error.message ? error.message : [NSNull null]), - @"details": (error.details ? error.details : [NSNull null]), - }; + @"code" : (error.code ? error.code : [NSNull null]), + @"message" : (error.message ? error.message : [NSNull null]), + @"details" : (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result": (result ? result : [NSNull null]), - @"error": errorDict, - }; + @"result" : (result ? result : [NSNull null]), + @"error" : errorDict, + }; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -69,12 +68,14 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -85,12 +86,14 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -101,12 +104,14 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -117,7 +122,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -133,12 +138,14 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -149,10 +156,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -170,15 +177,22 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", + (self.httpMethod ? self.httpMethod : [NSNull null]), + @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), + @"httpBody", + (self.allHttpHeaderFields ? self.allHttpHeaderFields + : [NSNull null]), + @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -188,19 +202,27 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = + [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", + (self.injectionTime ? [self.injectionTime toMap] + : [NSNull null]), + @"injectionTime", + (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), + @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData -+ (instancetype)makeWithProperties:(NSDictionary *)properties { - FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; ++ (instancetype)makeWithProperties: + (NSDictionary *)properties { + FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.properties = properties; return pigeonResult; } @@ -211,22 +233,22 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.properties ? self.properties : [NSNull null]), @"properties", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.properties ? self.properties : [NSNull null]), + @"properties", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -234,13 +256,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -261,43 +281,52 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createDefaultDataStoreWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -305,30 +334,36 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId + ofTypes:arg_dataTypes + modifiedSince:arg_secondsModifiedSinceEpoch + completion:^(NSNumber *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -358,42 +393,48 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(contentOffsetForViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId error:&error]; + NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: + toValue:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -402,19 +443,20 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -423,8 +465,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -454,63 +495,73 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier: + toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -520,30 +571,34 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO [api scrollByForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId + toX:arg_x + y:arg_y + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -551,15 +606,13 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -567,13 +620,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -594,22 +645,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -617,71 +671,87 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." + @"setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: + forTypes:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId + forTypes:arg_types + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -689,18 +759,16 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -708,17 +776,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -739,86 +804,109 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = + [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addScriptMessageHandlerForControllerWithIdentifier: + handlerIdentifier:ofName:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" + @"ofName:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + handlerIdentifier:arg_handlerInstanceid + ofName:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + name:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -826,40 +914,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: + userScript:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId + userScript:arg_userScript + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllUserScriptsForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -867,8 +961,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -898,53 +991,63 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = + [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId + isEnabled:arg_enabled + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -974,22 +1077,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = + [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -997,8 +1103,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1028,22 +1133,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1051,29 +1159,33 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId + functionIdentifier:arg_functionInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1103,15 +1215,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKNavigationDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1123,29 +1235,35 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId + webViewIdentifier:(NSNumber *)arg_webViewInstanceId + URL:(nullable NSString *)arg_url + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, + (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, + (arg_url == nil) ? [NSNull null] : arg_url + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1153,13 +1271,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1180,22 +1296,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = + [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(disposeObjectWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1203,53 +1322,67 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addObserverForObjectWithIdentifier: + observerIdentifier:keyPath:options:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = + GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + options:arg_options + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: + observerIdentifier:keyPath:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1279,15 +1412,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = + [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFFunctionFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1299,50 +1432,49 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1350,41 +1482,32 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1405,85 +1528,101 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_uiDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_navigationDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(URLForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1491,39 +1630,44 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: + error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: + request:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1532,63 +1676,75 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: + HTMLString:baseURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId + HTMLString:arg_string + baseURL:arg_baseUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); + NSCAssert([api respondsToSelector:@selector + (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId + fileURL:arg_url + readAccessURL:arg_readAccessUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: + assetKey:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1597,19 +1753,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1617,19 +1774,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1637,19 +1795,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1657,19 +1816,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1677,19 +1837,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(reloadWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1697,19 +1858,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(titleForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1717,71 +1879,85 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: + userAgent:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId + javaScriptString:arg_javaScriptString + completion:^(id _Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1811,22 +1987,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec() ]; + codec:FWFWKUIDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1834,8 +2013,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1843,18 +2021,16 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1862,17 +2038,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1893,53 +2066,62 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: + dataStoreIdentifier:error:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId + dataStoreIdentifier:arg_websiteDataStoreInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: + cookie:completion:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_instanceId + cookie:arg_cookie + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m index e4218c7a4a4e..e185230ce868 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -19,17 +19,18 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSNumber *)instanceId API_AVAILABLE(ios(11.0)){ - return (WKHTTPCookieStore - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSNumber *)instanceId + API_AVAILABLE(ios(11.0)) { + return (WKHTTPCookieStore *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - - (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)instanceId dataStoreIdentifier:(nonnull NSNumber *)websiteDataStoreInstanceId - error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + error:(FlutterError *_Nullable __autoreleasing *_Nonnull) + error { if (@available(iOS 11.0, *)) { - WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:websiteDataStoreInstanceId.longValue]; + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[self.instanceManager + instanceForIdentifier:websiteDataStoreInstanceId.longValue]; [self.instanceManager addInstance:dataStore.httpCookieStore withIdentifier:instanceId.longValue]; } else { @@ -39,15 +40,16 @@ - (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)instanceId } } -- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId cookie:(nonnull FWFNSHttpCookieData *)cookie completion:(nonnull void (^)(FlutterError * _Nullable))completion { +- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId + cookie:(nonnull FWFNSHttpCookieData *)cookie + completion:(nonnull void (^)(FlutterError *_Nullable))completion { NSHTTPCookie *nsCookie = FWFNSHTTPCookieFromCookieData(cookie); - + if (@available(iOS 11.0, *)) { [[self HTTPCookieStoreForIdentifier:instanceId] setCookie:nsCookie completionHandler:^{ - completion(nil); - } - ]; + completion(nil); + }]; } else { completion([FlutterError errorWithCode:@"FWFUnsupportedVersionError" message:@"setCookie is only supported on versions 11+." diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m index 0312d26d49a9..f907d211f08e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -18,8 +18,8 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKPreferences*)preferencesForIdentifier:(NSNumber *)instanceId { - return (WKPreferences*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (WKPreferences *)preferencesForIdentifier:(NSNumber *)instanceId { + return (WKPreferences *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId @@ -31,14 +31,14 @@ - (void)createWithIdentifier:(nonnull NSNumber *)instanceId - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; } - - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId - isEnabled:(nonnull NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull) error { + isEnabled:(nonnull NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error { [[self preferencesForIdentifier:instanceId] setJavaScriptEnabled:enabled.boolValue]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m index a1fbd4f4e4e4..e30abe1f9ba8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -19,8 +19,9 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKWebViewConfiguration*)webViewConfigurationForIdentifier:(NSNumber *)instanceId { - return (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + return (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId @@ -32,22 +33,33 @@ - (void)createWithIdentifier:(nonnull NSNumber *)instanceId - (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId webViewIdentifier:(nonnull NSNumber *)webViewInstanceId error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewInstanceId.longValue]; + WKWebView *webView = + (WKWebView *)[self.instanceManager instanceForIdentifier:webViewInstanceId.longValue]; [self.instanceManager addInstance:webView.configuration withIdentifier:instanceId.longValue]; } - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId isAllowed:(nonnull NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull) error { - [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback:allow.boolValue]; + error: + (FlutterError *_Nullable *_Nonnull) + error { + [[self webViewConfigurationForIdentifier:instanceId] + setAllowsInlineMediaPlayback:allow.boolValue]; } -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - forTypes:(nonnull NSArray *)types - error:(FlutterError *_Nullable *_Nonnull) error { +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + forTypes: + (nonnull NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error { NSAssert(types.count, @"Types must not be empty."); - - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self webViewConfigurationForIdentifier:instanceId]; + + WKWebViewConfiguration *configuration = + (WKWebViewConfiguration *)[self webViewConfigurationForIdentifier:instanceId]; if (@available(iOS 10.0, *)) { WKAudiovisualMediaTypes typesInt = 0; for (FWFWKAudiovisualMediaTypeEnumData *data in types) { @@ -56,7 +68,7 @@ - (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull N [configuration setMediaTypesRequiringUserActionForPlayback:typesInt]; } else { for (FWFWKAudiovisualMediaTypeEnumData *data in types) { - switch(data.value) { + switch (data.value) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" case FWFWKAudiovisualMediaTypeEnumNone: diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m index bd94c897c084..78492e0d3366 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -20,40 +20,52 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { - return (WKWebsiteDataStore*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + return (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.websiteDataStore withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.websiteDataStore + withIdentifier:instanceId.longValue]; } -- (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { - [self.instanceManager addInstance:[WKWebsiteDataStore defaultDataStore] withIdentifier:instanceId.longValue]; +- (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable __autoreleasing *_Nonnull) + error { + [self.instanceManager addInstance:[WKWebsiteDataStore defaultDataStore] + withIdentifier:instanceId.longValue]; } - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - ofTypes:(nonnull NSArray *)dataTypes - modifiedSince:(nonnull NSNumber *)secondsModifiedSinceEpoch - completion:(nonnull void (^)(NSNumber * _Nullable, FlutterError * _Nullable))completion { + ofTypes:(nonnull NSArray *) + dataTypes + modifiedSince:(nonnull NSNumber *)secondsModifiedSinceEpoch + completion: + (nonnull void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion { NSMutableSet *stringDataTypes = [NSMutableSet set]; for (FWFWKWebsiteDataTypeEnumData *type in dataTypes) { [stringDataTypes addObject:FWFWKWebsiteDataTypeFromEnumData(type)]; } - - WKWebsiteDataStore *dataStore =[self websiteDataStoreForIdentifier:instanceId]; - [dataStore fetchDataRecordsOfTypes:stringDataTypes completionHandler:^(NSArray *records) { - [dataStore removeDataOfTypes:stringDataTypes - modifiedSince:[NSDate dateWithTimeIntervalSince1970:secondsModifiedSinceEpoch.doubleValue] - completionHandler:^{ - if (records.count > 0) { - completion(@YES, nil); - } else { - completion(@NO, nil); - } - }]; - }]; + + WKWebsiteDataStore *dataStore = [self websiteDataStoreForIdentifier:instanceId]; + [dataStore + fetchDataRecordsOfTypes:stringDataTypes + completionHandler:^(NSArray *records) { + [dataStore + removeDataOfTypes:stringDataTypes + modifiedSince:[NSDate dateWithTimeIntervalSince1970:secondsModifiedSinceEpoch + .doubleValue] + completionHandler:^{ + if (records.count > 0) { + completion(@YES, nil); + } else { + completion(@NO, nil); + } + }]; + }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index b837fbeb77e8..92ae434f3edf 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -9,11 +9,11 @@ #import #import #import +#import #import +#import +#import #import +#import #import #import -#import -#import -#import -#import 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 6d86436d9656..04fdf4d9fa56 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 @@ -221,7 +221,9 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), + allHttpHeaderFields: + (pigeonMap['allHttpHeaderFields'] as Map?)! + .cast(), ); } } @@ -250,7 +252,8 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode( + pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -273,7 +276,8 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - properties: (pigeonMap['properties'] as Map?)!.cast(), + properties: (pigeonMap['properties'] as Map?)! + .cast(), ); } } @@ -285,20 +289,19 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -307,24 +310,30 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -337,7 +346,9 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -346,7 +357,8 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -357,18 +369,26 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes( + int arg_instanceId, + List arg_dataTypes, + double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_dataTypes, + arg_secondsModifiedSinceEpoch + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -393,7 +413,8 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -401,7 +422,8 @@ class UIViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -410,7 +432,8 @@ class UIViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -428,16 +451,18 @@ class UIViewHostApi { Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -450,16 +475,18 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -479,24 +506,29 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -509,7 +541,8 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -518,7 +551,8 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -536,16 +570,19 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -556,18 +593,22 @@ class UIScrollViewHostApi { } } - Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset( + int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -586,20 +627,19 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -608,15 +648,18 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -625,7 +668,8 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -636,18 +680,23 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -658,18 +707,22 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -680,18 +733,22 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, + List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -710,27 +767,25 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -739,24 +794,31 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -767,18 +829,23 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler( + int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_handlerInstanceid, arg_name]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -789,18 +856,22 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler( + int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -813,7 +884,9 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -822,7 +895,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -833,18 +907,23 @@ class WKUserContentControllerHostApi { } } - Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript( + int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) as Map?; + await channel.send([arg_instanceId, arg_userScript]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -857,7 +936,9 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -866,7 +947,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -886,24 +968,30 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -914,18 +1002,21 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -945,15 +1036,18 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = + _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -962,7 +1056,8 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -982,15 +1077,18 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -999,7 +1097,8 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1010,18 +1109,23 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation( + int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1036,26 +1140,36 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } + abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation( + int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation( + arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1070,20 +1184,19 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1092,7 +1205,8 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1100,7 +1214,8 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1109,7 +1224,8 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1120,18 +1236,28 @@ class NSObjectHostApi { } } - Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { + Future addObserver( + int arg_instanceId, + int arg_observerInstanceId, + String arg_keyPath, + List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_observerInstanceId, + arg_keyPath, + arg_options + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1142,18 +1268,22 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, + String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send( + [arg_instanceId, arg_observerInstanceId, arg_keyPath]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1168,22 +1298,27 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } + abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1199,69 +1334,61 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1270,24 +1397,29 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create(int arg_instanceId, int arg_configurationInstanceId) async { + Future create( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1298,18 +1430,22 @@ class WKWebViewHostApi { } } - Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate( + int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1320,18 +1456,22 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate( + int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_navigationDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1344,7 +1484,8 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1353,7 +1494,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1366,7 +1508,8 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1375,7 +1518,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1391,18 +1535,21 @@ class WKWebViewHostApi { } } - Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest( + int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1413,18 +1560,22 @@ class WKWebViewHostApi { } } - Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString( + int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1435,18 +1586,22 @@ class WKWebViewHostApi { } } - Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl( + int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_url, arg_readAccessUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1459,16 +1614,18 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1481,7 +1638,8 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1490,7 +1648,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1508,7 +1667,8 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1517,7 +1677,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1535,7 +1696,8 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1544,7 +1706,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1557,7 +1720,8 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1566,7 +1730,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1579,7 +1744,8 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1588,7 +1754,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1601,7 +1768,8 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1610,7 +1778,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1621,18 +1790,22 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1643,18 +1816,22 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent( + int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) as Map?; + await channel.send([arg_instanceId, arg_userAgent]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1665,18 +1842,22 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript( + int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1696,7 +1877,8 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1704,7 +1886,8 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1713,7 +1896,8 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1732,27 +1916,25 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1761,24 +1943,30 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore( + int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_websiteDataStoreInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1789,18 +1977,21 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie( + int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h index e3282d859ace..482c791d66d4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h @@ -1,36 +1,45 @@ /** - * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. + * Converts an FWFNSKeyValueObservingOptionsEnumData to an + * NSKeyValueObservingOptions. * - * @param data The data object containing information to create an NSKeyValueObservingOptions. + * @param data The data object containing information to create an + * NSKeyValueObservingOptions. * * @return An NSKeyValueObservingOptions or -1 if data could not be converted. */ -extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data); +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData* data); /** * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. * - * @param data The data object containing information to create an NSKeyValueChange. + * @param data The data object containing information to create an + * NSKeyValueChange. * * @return An NSKeyValueChange or -1 if data could not be converted. */ -extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data); +extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData( + FWFNSKeyValueChangeEnumData* data); /** * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. * - * @param data The data object containing information to create an NSKeyValueChangeKey. + * @param data The data object containing information to create an + * NSKeyValueChangeKey. * * @return An NSKeyValueChangeKey or -1 if data could not be converted. */ -extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data); +extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData( + FWFNSKeyValueChangeKeyEnumData* data); /** * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. * - * @param data The data object containing information to create an NSHttpCookiePropertyKey. + * @param data The data object containing information to create an + * NSHttpCookiePropertyKey. * * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. */ -extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data); +extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData* data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m index 543ec2998ede..88aefa418f98 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m @@ -1,113 +1,107 @@ -NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { - switch(data.value) { - +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData *data) { + switch (data.value) { case FWFNSKeyValueObservingOptionsEnumNewValue: return NSKeyValueObservingOptionsNewValue; - + case FWFNSKeyValueObservingOptionsEnumOldValue: return NSKeyValueObservingOptionsOldValue; - + case FWFNSKeyValueObservingOptionsEnumInitialValue: return NSKeyValueObservingOptionsInitialValue; - + case FWFNSKeyValueObservingOptionsEnumPriorNotification: return NSKeyValueObservingOptionsPriorNotification; - } - + return -1; } NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data) { - switch(data.value) { - + switch (data.value) { case FWFNSKeyValueChangeEnumSetting: return NSKeyValueChangeSetting; - + case FWFNSKeyValueChangeEnumInsertion: return NSKeyValueChangeInsertion; - + case FWFNSKeyValueChangeEnumRemoval: return NSKeyValueChangeRemoval; - + case FWFNSKeyValueChangeEnumReplacement: return NSKeyValueChangeReplacement; - } - + return -1; } NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data) { - switch(data.value) { - + switch (data.value) { case FWFNSKeyValueChangeKeyEnumIndexes: return NSKeyValueChangeKeyIndexes; - + case FWFNSKeyValueChangeKeyEnumKind: return NSKeyValueChangeKeyKind; - + case FWFNSKeyValueChangeKeyEnumNewValue: return NSKeyValueChangeKeyNewValue; - + case FWFNSKeyValueChangeKeyEnumNotificationIsPrior: return NSKeyValueChangeKeyNotificationIsPrior; - + case FWFNSKeyValueChangeKeyEnumOldValue: return NSKeyValueChangeKeyOldValue; - } - + return -1; } -NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { - switch(data.value) { - +NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData *data) { + switch (data.value) { case FWFNSHttpCookiePropertyKeyEnumComment: return NSHttpCookiePropertyKeyComment; - + case FWFNSHttpCookiePropertyKeyEnumCommentUrl: return NSHttpCookiePropertyKeyCommentUrl; - + case FWFNSHttpCookiePropertyKeyEnumDiscard: return NSHttpCookiePropertyKeyDiscard; - + case FWFNSHttpCookiePropertyKeyEnumDomain: return NSHttpCookiePropertyKeyDomain; - + case FWFNSHttpCookiePropertyKeyEnumExpires: return NSHttpCookiePropertyKeyExpires; - + case FWFNSHttpCookiePropertyKeyEnumMaximumAge: return NSHttpCookiePropertyKeyMaximumAge; - + case FWFNSHttpCookiePropertyKeyEnumName: return NSHttpCookiePropertyKeyName; - + case FWFNSHttpCookiePropertyKeyEnumOriginUrl: return NSHttpCookiePropertyKeyOriginUrl; - + case FWFNSHttpCookiePropertyKeyEnumPath: return NSHttpCookiePropertyKeyPath; - + case FWFNSHttpCookiePropertyKeyEnumPort: return NSHttpCookiePropertyKeyPort; - + case FWFNSHttpCookiePropertyKeyEnumSameSitePolicy: return NSHttpCookiePropertyKeySameSitePolicy; - + case FWFNSHttpCookiePropertyKeyEnumSecure: return NSHttpCookiePropertyKeySecure; - + case FWFNSHttpCookiePropertyKeyEnumValue: return NSHttpCookiePropertyKeyValue; - + case FWFNSHttpCookiePropertyKeyEnumVersion: return NSHttpCookiePropertyKeyVersion; - } - + return -1; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h index 60741663a5cb..5918169d8b91 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h @@ -6,5 +6,5 @@ * * @return An __name__ or -1 if data could not be converted. */ -extern __name__ FWF__name__FromEnumData(FWF__name__EnumData *data); +extern __name__ FWF__name__FromEnumData(FWF__name__EnumData* data); /*-*/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m index 1d8e1c8e143a..95fdab7d411a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m @@ -1,12 +1,12 @@ /*iterate enums enum*/ __name__ FWF__name__FromEnumData(FWF__name__EnumData *data) { - switch(data.value) { + switch (data.value) { /*iterate values value*/ - case FWF__enum_name__Enum/*replace :case=pascal name*/name/**/: - return __enum_name__/*replace :case=pascal name*/name/**/; - /**/ + case FWF__enum_name__Enum /*replace :case=pascal name*/ name /**/: + return __enum_name__ /*replace :case=pascal name*/ name /**/; + /**/ } - + return -1; } /**/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h index 6c846cfb8180..3909b9c11b38 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h @@ -11,8 +11,6 @@ NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKPreferences. * @@ -36,8 +34,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKWebsiteDataStore. * @@ -61,8 +57,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKHttpCookieStore. * @@ -86,8 +80,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKScriptMessageHandler. * @@ -111,8 +103,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKUserContentController. * @@ -136,8 +126,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKWebViewConfiguration. * @@ -161,14 +149,12 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - /** * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. */ -@interface FWFUIDelegate : NSObject +@interface FWFUIDelegate : NSObject @end - /** * Host api implementation for WKUIDelegate. * @@ -192,14 +178,12 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - /** * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. */ -@interface FWFNavigationDelegate : NSObject +@interface FWFNavigationDelegate : NSObject @end - /** * Host api implementation for WKNavigationDelegate. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m index 6591dfde2d9b..ed02c6c075e4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m @@ -3,12 +3,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFPreferencesHostApi.h" #import "FWFDataConverters.h" +#import "FWFPreferencesHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - - @interface FWFPreferencesHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -23,51 +21,45 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKPreferences - - *)preferencesForIdentifier:(NSNumber *)instanceId { - return ( - - + WKPreferences - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)preferencesForIdentifier:(NSNumber *)instanceId { + return ( + + WKPreferences + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKPreferences - - *preferences = - - - [[WKPreferences alloc] init]; - + + *preferences = + + [[WKPreferences alloc] init]; + [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; } - - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId - enabled:(nonnull NSNumber *)enabled + enabled:(nonnull NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull) error { - + error:(FlutterError *_Nullable *_Nonnull)error { [[self preferencesForIdentifier:instanceId] setJavaScriptEnabled - - :enabled - - + +:enabled + ]; } @@ -77,11 +69,9 @@ - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)ins // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFWebsiteDataStoreHostApi.h" #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" - - +#import "FWFWebsiteDataStoreHostApi.h" @interface FWFWebsiteDataStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -97,55 +87,51 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebsiteDataStore - - *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { - return ( - - + WKWebsiteDataStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { + return ( + + WKWebsiteDataStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKWebsiteDataStore - - *websiteDataStore = - - - [[WKWebsiteDataStore alloc] init]; - + + *websiteDataStore = + + [[WKWebsiteDataStore alloc] init]; + [self.instanceManager addInstance:websiteDataStore withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.websiteDataStore withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.websiteDataStore + withIdentifier:instanceId.longValue]; } - - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - dataTypes:(nonnull NSArray *)dataTypes + dataTypes: + (nonnull NSArray *)dataTypes + + since:(nonnull NSNumber *)since + + error:(FlutterError *_Nullable *_Nonnull)error { + return [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes - since:(nonnull NSNumber *)since + :dataTypes + + since:since - error:(FlutterError *_Nullable *_Nonnull) error { - return - [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes - - :dataTypes - - - since:since - ]; } @@ -155,12 +141,10 @@ - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFHttpCookieStoreHostApi.h" #import "FWFDataConverters.h" +#import "FWFHttpCookieStoreHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - - @interface FWFHttpCookieStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -175,51 +159,46 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKHttpCookieStore - - *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { - return ( - - + WKHttpCookieStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { + return ( + + WKHttpCookieStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKHttpCookieStore - - *httpCookieStore = - - - [[WKHttpCookieStore alloc] init]; - + + *httpCookieStore = + + [[WKHttpCookieStore alloc] init]; + [self.instanceManager addInstance:httpCookieStore withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.httpCookieStore withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.httpCookieStore + withIdentifier:instanceId.longValue]; } - - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId - cookie:(nonnull NSHttpCookie *)cookie + cookie:(nonnull NSHttpCookie *)cookie - error:(FlutterError *_Nullable *_Nonnull) error { - + error:(FlutterError *_Nullable *_Nonnull)error { [[self httpCookieStoreForIdentifier:instanceId] setCookie - - :cookie - - + +:cookie + ]; } @@ -229,12 +208,10 @@ - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFScriptMessageHandlerHostApi.h" #import "FWFDataConverters.h" +#import "FWFScriptMessageHandlerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - - @interface FWFScriptMessageHandlerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -249,52 +226,47 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKScriptMessageHandler - - *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { - return ( - - + WKScriptMessageHandler - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { + return ( + + WKScriptMessageHandler + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKScriptMessageHandler - - *scriptMessageHandler = - - - [[WKScriptMessageHandler alloc] init]; - + + *scriptMessageHandler = + + [[WKScriptMessageHandler alloc] init]; + [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.scriptMessageHandler withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.scriptMessageHandler + withIdentifier:instanceId.longValue]; } - @end // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFUserContentControllerHostApi.h" #import "FWFDataConverters.h" +#import "FWFUserContentControllerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - - @interface FWFUserContentControllerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -309,103 +281,94 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKUserContentController - - *)userContentControllerForIdentifier:(NSNumber *)instanceId { - return ( - - + WKUserContentController - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)userContentControllerForIdentifier:(NSNumber *)instanceId { + return ( + + WKUserContentController + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKUserContentController - - *userContentController = - - - [[WKUserContentController alloc] init]; - + + *userContentController = + + [[WKUserContentController alloc] init]; + [self.instanceManager addInstance:userContentController withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.userContentController withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.userContentController + withIdentifier:instanceId.longValue]; } - - (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - handler:(nonnull WKScriptMessageHandler *)handler + handler:(nonnull WKScriptMessageHandler *)handler - name:(nonnull NSString *)name + name:(nonnull NSString *)name - error:(FlutterError *_Nullable *_Nonnull) error { - + error: + (FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:instanceId] addScriptMessageHandler - - :handler - - - name:name - + + :handler + + name:name + ]; } - (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - name:(nonnull NSString *)name + name:(nonnull NSString *)name - error:(FlutterError *_Nullable *_Nonnull) error { - + error:(FlutterError *_Nullable *_Nonnull) + error { [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandler - - :name - - + +:name + ]; } - (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull) error { - + error: + (FlutterError *_Nullable *_Nonnull) + error { [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers - - + ]; } - (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId - userScript:(nonnull WKUserScript *)userScript + userScript:(nonnull WKUserScript *)userScript - error:(FlutterError *_Nullable *_Nonnull) error { - + error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:instanceId] addUserScript - - :userScript - - + +:userScript + ]; } - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull) error { - + error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:instanceId] removeAllUserScripts - - + ]; } @@ -415,12 +378,9 @@ - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)inst // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFWebViewConfigurationHostApi.h" #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" - - @interface FWFWebViewConfigurationHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -435,65 +395,66 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebViewConfiguration - - *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { - return ( - - + WKWebViewConfiguration - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + return ( + + WKWebViewConfiguration + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - WKWebViewConfiguration - - *webViewConfiguration = - - - [[WKWebViewConfiguration alloc] init]; - + + *webViewConfiguration = + + [[WKWebViewConfiguration alloc] init]; + [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.webViewConfiguration withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.webViewConfiguration + withIdentifier:instanceId.longValue]; } - - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - allow:(nonnull NSNumber *)allow + allow:(nonnull NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull) error { - + error: + (FlutterError *_Nullable *_Nonnull) + error { [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback - - :allow - - + +:allow + ]; } -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - types:(nonnull NSArray *)types + types: + (nonnull NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types - error:(FlutterError *_Nullable *_Nonnull) error { - + error: + (FlutterError *_Nullable *_Nonnull) + error { [[self webViewConfigurationForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback - - :types - - + +:types + ]; } @@ -503,15 +464,13 @@ - (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull N // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFUIDelegateHostApi.h" #import "FWFDataConverters.h" +#import "FWFUIDelegateHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - @implementation FWFUIDelegate @end - @interface FWFUIDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -525,56 +484,48 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- ( - FWFUIDelegate - - - *)uIDelegateForIdentifier:(NSNumber *)instanceId { +- (FWFUIDelegate + + *)uIDelegateForIdentifier:(NSNumber *)instanceId { return ( - - FWFUIDelegate - - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + FWFUIDelegate + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - FWFUIDelegate - - - *uIDelegate = - - [[FWFUIDelegate alloc] init]; - - + + *uIDelegate = + + [[FWFUIDelegate alloc] init]; + [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; [self.instanceManager addInstance:configuration.uIDelegate withIdentifier:instanceId.longValue]; } - @end // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFNavigationDelegateHostApi.h" #import "FWFDataConverters.h" +#import "FWFNavigationDelegateHostApi.h" #import "FWFWebViewConfigurationHostApi.h" - @implementation FWFNavigationDelegate @end - @interface FWFNavigationDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -588,39 +539,34 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- ( - FWFNavigationDelegate - - - *)navigationDelegateForIdentifier:(NSNumber *)instanceId { +- (FWFNavigationDelegate + + *)navigationDelegateForIdentifier:(NSNumber *)instanceId { return ( - - FWFNavigationDelegate - - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + FWFNavigationDelegate + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - FWFNavigationDelegate - - - *navigationDelegate = - - [[FWFNavigationDelegate alloc] init]; - - + + *navigationDelegate = + + [[FWFNavigationDelegate alloc] init]; + [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.navigationDelegate withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager addInstance:configuration.navigationDelegate + withIdentifier:instanceId.longValue]; } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m index e2fbb6cab52c..0776d5bb4ace 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m @@ -15,9 +15,7 @@ @interface FWFPreferencesHostApiTests : XCTestCase @implementation FWFPreferencesHostApiTests - (void)testSetJavaScriptEnabled { - - - WKPreferences + WKPreferences *mockPreferences = OCMClassMock([ @@ -33,15 +31,14 @@ - (void)testSetJavaScriptEnabled { FlutterError *error; [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 - - enabled:aValue - - error:&error]; + + enabled:aValue + + error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } @@ -64,9 +61,7 @@ @interface FWFWebsiteDataStoreHostApiTests : XCTestCase @implementation FWFWebsiteDataStoreHostApiTests - (void)testRemoveDataOfTypes { - - - WKWebsiteDataStore + WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([ @@ -82,19 +77,18 @@ - (void)testRemoveDataOfTypes { FlutterError *error; [hostApi removeDataFromDataStoreWithIdentifier:@0 - - dataTypes:aValue - - since:aValue - - error:&error]; + + dataTypes:aValue + + since:aValue + + error:&error]; OCMVerify([mockWebsiteDataStore removeDataOfTypes - - :aValue - - - since:aValue - + + :aValue + + since:aValue + ]); XCTAssertNil(error); } @@ -117,9 +111,7 @@ @interface FWFHttpCookieStoreHostApiTests : XCTestCase @implementation FWFHttpCookieStoreHostApiTests - (void)testSetCookie { - - - WKHttpCookieStore + WKHttpCookieStore *mockHttpCookieStore = OCMClassMock([ @@ -135,15 +127,14 @@ - (void)testSetCookie { FlutterError *error; [hostApi setCookieForStoreWithIdentifier:@0 - - cookie:aValue - - error:&error]; + + cookie:aValue + + error:&error]; OCMVerify([mockHttpCookieStore setCookie - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } @@ -183,9 +174,7 @@ @interface FWFUserContentControllerHostApiTests : XCTestCase @implementation FWFUserContentControllerHostApiTests - (void)testAddScriptMessageHandler { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -201,27 +190,24 @@ - (void)testAddScriptMessageHandler { FlutterError *error; [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 - - handler:aValue - - name:aValue - - error:&error]; + + handler:aValue + + name:aValue + + error:&error]; OCMVerify([mockUserContentController addScriptMessageHandler - - :aValue - - - name:aValue - + + :aValue + + name:aValue + ]); XCTAssertNil(error); } - (void)testRemoveScriptMessageHandler { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -237,23 +223,20 @@ - (void)testRemoveScriptMessageHandler { FlutterError *error; [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 - - name:aValue - - error:&error]; + + name:aValue + + error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandler - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } - (void)testRemoveAllScriptMessageHandlers { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -269,19 +252,16 @@ - (void)testRemoveAllScriptMessageHandlers { FlutterError *error; [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers - - + ]); XCTAssertNil(error); } - (void)testAddUserScript { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -297,23 +277,20 @@ - (void)testAddUserScript { FlutterError *error; [hostApi addUserScriptForControllerWithIdentifier:@0 - - userScript:aValue - - error:&error]; + + userScript:aValue + + error:&error]; OCMVerify([mockUserContentController addUserScript - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } - (void)testRemoveAllUserScripts { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -329,11 +306,10 @@ - (void)testRemoveAllUserScripts { FlutterError *error; [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllUserScripts - - + ]); XCTAssertNil(error); } @@ -356,9 +332,7 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @implementation FWFWebViewConfigurationHostApiTests - (void)testSetAllowsInlineMediaPlayback { - - - WKWebViewConfiguration + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -374,23 +348,20 @@ - (void)testSetAllowsInlineMediaPlayback { FlutterError *error; [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - - allow:aValue - - error:&error]; + + allow:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } - (void)testSetMediaTypesRequiringUserActionForPlayback { - - - WKWebViewConfiguration + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -406,15 +377,14 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { FlutterError *error; [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 - - types:aValue - - error:&error]; + + types:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback - - :aValue - - + +:aValue + ]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h index 9e3c9487c0bb..4a45273a3779 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Implementation of __name__ for FWF__customValues_nameWithoutPrefix__HostApiImpl. */ -@interface FWF__customValues_nameWithoutPrefix__ : NSObject<__name__> +@interface FWF__customValues_nameWithoutPrefix__ : NSObject <__name__> @end /*-*/ diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m index fb4f9b1b832b..057c9d21557f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m @@ -3,9 +3,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWF__customValues_nameWithoutPrefix__HostApi.h" #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWF__customValues_nameWithoutPrefix__HostApi.h" /*if customValues_isProtocol*/ @implementation FWF__customValues_nameWithoutPrefix__ @@ -26,61 +26,69 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - (/*if customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ - /**/ - *)/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ForIdentifier:(NSNumber *)instanceId { + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + *)/*replace :case=camel customValues_nameWithoutPrefix*/ name + /**/ ForIdentifier:(NSNumber *)instanceId { return ( - /*if customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ - /**/ - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + /*if customValues_isProtocol*/ + FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { /*if customValues_isProtocol*/ FWF__customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ + /**/ + * /*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ + = + /*if customValues_isProtocol*/ + [[FWF__customValues_nameWithoutPrefix__ alloc] init]; /**/ /*if! customValues_isProtocol*/ - __name__ - /**/ - */*replace :case=camel customValues_nameWithoutPrefix*/name/**/ = - /*if customValues_isProtocol*/ - [[FWF__customValues_nameWithoutPrefix__ alloc] init]; - /**/ - /*if! customValues_isProtocol*/ - [[__name__ alloc] init]; + [[__name__ alloc] init]; /**/ - [self.instanceManager addInstance:/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId configurationIdentifier:(nonnull NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration./*replace :case=camel customValues_nameWithoutPrefix*/name/**/ withIdentifier:instanceId.longValue]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager + addInstance:configuration./*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ + withIdentifier:instanceId.longValue]; } /*iterate methods method*/ - (void)__customValues_objcName__:(nonnull NSNumber *)instanceId -/*iterate parameters parameter*/ - __name__:(/*if type_nullable*/nullable/**//*if! type_nullable*/nonnull/**/ __type_customValues_objcName__ *)__name__ -/**/ - error:(FlutterError *_Nullable *_Nonnull) error { - /*if! customValues_returnsVoid*/return/**/ - [[self /*replace :case=camel class_customValues_nameWithoutPrefix*/name/**/ForIdentifier:instanceId] __name__ - /*iterate :end=1 parameters parameter*/ - :__name__ - /**/ - /*iterate :start=1 parameters parameter*/ - __name__:__name__ - /**/ + /*iterate parameters parameter*/ + __name__:(/*if type_nullable*/ nullable /**/ /*if! type_nullable*/ + nonnull /**/ __type_customValues_objcName__ *)__name__ + /**/ + error:(FlutterError *_Nullable *_Nonnull)error { + /*if! customValues_returnsVoid*/ return /**/ + [[self /*replace :case=camel class_customValues_nameWithoutPrefix*/ + name /**/ ForIdentifier:instanceId] __name__ +/*iterate :end=1 parameters parameter*/ +:__name__ + /**/ + /*iterate :start=1 parameters parameter*/ + __name__:__name__ + /**/ ]; } /**/ diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m index 99fdc431f11b..080b0022acd4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m @@ -14,9 +14,9 @@ @interface FWF__customValues_nameWithoutPrefix__HostApiTests : XCTestCase @implementation FWF__customValues_nameWithoutPrefix__HostApiTests /*iterate methods method*/ -- (void)test/*replace :case=pascal name*/methodName/**/ { +- (void)test /*replace :case=pascal name*/ methodName /**/ { /*if class_customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ + FWF__class_customValues_nameWithoutPrefix__ /**/ /*if! class_customValues_isProtocol*/ __class_name__ @@ -33,21 +33,22 @@ - (void)test/*replace :case=pascal name*/methodName/**/ { [instanceManager addInstance:mock__class_customValues_nameWithoutPrefix__ withIdentifier:0]; FWF__class_customValues_nameWithoutPrefix__HostApiImpl *hostApi = - [[FWF__class_customValues_nameWithoutPrefix__HostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWF__class_customValues_nameWithoutPrefix__HostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi __customValues_objcName__:@0 - /*iterate parameters parameter*/ - __name__:aValue - /**/ - error:&error]; + /*iterate parameters parameter*/ + __name__:aValue + /**/ + error:&error]; OCMVerify([mock__class_customValues_nameWithoutPrefix__ __name__ - /*iterate :end=1 parameters parameter*/ - :aValue - /**/ - /*iterate :start=1 parameters parameter*/ - __name__:aValue - /**/ +/*iterate :end=1 parameters parameter*/ +:aValue + /**/ + /*iterate :start=1 parameters parameter*/ + __name__:aValue + /**/ ]); XCTAssertNil(error); } 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 e128a62d34d9..4dba81cb21fa 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 @@ -21,59 +21,75 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); void createDefaultDataStore(int instanceId); - Future removeDataOfTypes(int instanceId, List dataTypes, double secondsModifiedSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes( + int instanceId, + List dataTypes, + double secondsModifiedSinceEpoch); + static void setup(TestWKWebsiteDataStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_instanceId!); return {}; }); @@ -81,20 +97,28 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = + (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); final double? arg_secondsModifiedSinceEpoch = (args[2] as double?); - assert(arg_secondsModifiedSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); + assert(arg_secondsModifiedSinceEpoch != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes( + arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); return {'result': output}; }); } @@ -105,24 +129,29 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } + abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); List getContentOffset(int instanceId); void setBackgroundColor(int instanceId, int? value); void setOpaque(int instanceId, bool opaque); - static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -130,15 +159,18 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_instanceId!, arg_value); return {}; @@ -147,17 +179,21 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_instanceId!, arg_opaque!); return {}; }); @@ -169,6 +205,7 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } + abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -176,20 +213,25 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int instanceId); void scrollBy(int instanceId, double x, double y); void setContentOffset(int instanceId, double x, double y); - static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -197,15 +239,18 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -213,19 +258,24 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -233,19 +283,24 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -261,42 +316,48 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _TestWKWebViewConfigurationHostApiCodec(); void create(int instanceId); void createFromWebView(int instanceId, int webViewInstanceId); void setAllowsInlineMediaPlayback(int instanceId, bool allow); - void setMediaTypesRequiringUserActionForPlayback(int instanceId, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback( + int instanceId, List types); + static void setup(TestWKWebViewConfigurationHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -304,17 +365,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -322,17 +388,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_instanceId!, arg_allow!); return {}; }); @@ -340,18 +411,26 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = (args[1] as List?)?.cast(); - assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback(arg_instanceId!, arg_types!); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = + (args[1] as List?) + ?.cast(); + assert(arg_types != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback( + arg_instanceId!, arg_types!); return {}; }); } @@ -366,91 +445,112 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); - void addScriptMessageHandler(int instanceId, int handlerInstanceid, String name); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); + void addScriptMessageHandler( + int instanceId, int handlerInstanceid, String name); void removeScriptMessageHandler(int instanceId, String name); void removeAllScriptMessageHandlers(int instanceId); void addUserScript(int instanceId, WKUserScriptData userScript); void removeAllUserScripts(int instanceId); - static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerInstanceid = (args[1] as int?); - assert(arg_handlerInstanceid != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerInstanceid != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler(arg_instanceId!, arg_handlerInstanceid!, arg_name!); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler( + arg_instanceId!, arg_handlerInstanceid!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_instanceId!, arg_name!); return {}; }); @@ -458,15 +558,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_instanceId!); return {}; }); @@ -474,17 +578,23 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); - assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = + (args[1] as WKUserScriptData?); + assert(arg_userScript != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_instanceId!, arg_userScript!); return {}; }); @@ -492,15 +602,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_instanceId!); return {}; }); @@ -512,43 +626,56 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } + abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); void setJavaScriptEnabled(int instanceId, bool enabled); - static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_enabled!); return {}; }); @@ -560,22 +687,28 @@ abstract class TestWKPreferencesHostApi { class _TestWKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { const _TestWKScriptMessageHandlerHostApiCodec(); } + abstract class TestWKScriptMessageHandlerHostApi { - static const MessageCodec codec = _TestWKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = + _TestWKScriptMessageHandlerHostApiCodec(); void create(int instanceId); - static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -587,23 +720,29 @@ abstract class TestWKScriptMessageHandlerHostApi { class _TestWKNavigationDelegateHostApiCodec extends StandardMessageCodec { const _TestWKNavigationDelegateHostApiCodec(); } + abstract class TestWKNavigationDelegateHostApi { - static const MessageCodec codec = _TestWKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = + _TestWKNavigationDelegateHostApiCodec(); void create(int instanceId); void setDidFinishNavigation(int instanceId, int? functionInstanceId); - static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -611,15 +750,19 @@ abstract class TestWKNavigationDelegateHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); final int? arg_functionInstanceId = (args[1] as int?); api.setDidFinishNavigation(arg_instanceId!, arg_functionInstanceId); return {}; @@ -636,41 +779,46 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestNSObjectHostApi { static const MessageCodec codec = _TestNSObjectHostApiCodec(); void dispose(int instanceId); - void addObserver(int instanceId, int observerInstanceId, String keyPath, List options); + void addObserver(int instanceId, int observerInstanceId, String keyPath, + List options); void removeObserver(int instanceId, int observerInstanceId, String keyPath); - static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return {}; }); @@ -678,42 +826,57 @@ abstract class TestNSObjectHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = (args[3] as List?)?.cast(); - assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!, arg_options!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = + (args[3] as List?) + ?.cast(); + assert(arg_options != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_instanceId!, arg_observerInstanceId!, + arg_keyPath!, arg_options!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver( + arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); return {}; }); } @@ -728,72 +891,65 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -815,20 +971,25 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int instanceId, bool allow); void setCustomUserAgent(int instanceId, String? userAgent); Future evaluateJavaScript(int instanceId, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_configurationInstanceId!); return {}; }); @@ -836,15 +997,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateInstanceId = (args[1] as int?); api.setUIDelegate(arg_instanceId!, arg_uiDelegateInstanceId); return {}; @@ -853,32 +1017,39 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateInstanceId = (args[1] as int?); - api.setNavigationDelegate(arg_instanceId!, arg_navigationDelegateInstanceId); + api.setNavigationDelegate( + arg_instanceId!, arg_navigationDelegateInstanceId); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return {'result': output}; }); @@ -886,15 +1057,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_instanceId!); return {'result': output}; }); @@ -902,17 +1076,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_instanceId!, arg_request!); return {}; }); @@ -920,17 +1098,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_instanceId!, arg_string!, arg_baseUrl); return {}; @@ -939,19 +1121,24 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_instanceId!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -959,17 +1146,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_instanceId!, arg_key!); return {}; }); @@ -977,15 +1168,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return {'result': output}; }); @@ -993,15 +1187,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return {'result': output}; }); @@ -1009,15 +1206,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return {}; }); @@ -1025,15 +1225,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return {}; }); @@ -1041,15 +1244,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return {}; }); @@ -1057,15 +1263,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return {'result': output}; }); @@ -1073,33 +1282,42 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures(arg_instanceId!, arg_allow!); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures( + arg_instanceId!, arg_allow!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_instanceId!, arg_userAgent); return {}; @@ -1108,18 +1326,23 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript(arg_instanceId!, arg_javaScriptString!); + assert(arg_javaScriptString != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript( + arg_instanceId!, arg_javaScriptString!); return {'result': output}; }); } @@ -1130,22 +1353,27 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } + abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int instanceId); - static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -1161,67 +1389,79 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore(int instanceId, int websiteDataStoreInstanceId); + void createFromWebsiteDataStore( + int instanceId, int websiteDataStoreInstanceId); Future setCookie(int instanceId, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreInstanceId = (args[1] as int?); - assert(arg_websiteDataStoreInstanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore(arg_instanceId!, arg_websiteDataStoreInstanceId!); + assert(arg_websiteDataStoreInstanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore( + arg_instanceId!, arg_websiteDataStoreInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_instanceId!, arg_cookie!); return {}; }); From e10b1fb91b007c9d882185290183c13aa8c953a2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 11:35:26 -0700 Subject: [PATCH 05/23] fix cookie host api --- .../FWFHTTPCookieStoreHostApiTests.m | 6 +- .../FWFWebViewConfigurationHostApiTests.m | 2 - .../FWFWebsiteDataStoreHostApiTests.m | 2 - .../ios/Classes/FWFDataConverters.m | 6 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 275 +--- .../ios/Classes/FWFGeneratedWebKitApis.m | 1324 +++++++---------- .../lib/src/common/web_kit.pigeon.dart | 761 ++++------ .../lib/src/web_kit/data_output.h | 27 +- .../lib/src/web_kit/web_kit.simple_ast.json | 37 - .../lib/src/web_kit/web_kit_api_impls.dart | 12 +- .../pigeons/web_kit.dart | 9 +- .../src/foundation/foundation_test.mocks.dart | 2 +- .../test/src/ui_kit/ui_kit_test.mocks.dart | 2 +- .../test/src/web_kit/web_kit_test.dart | 4 +- .../test/src/web_kit/web_kit_test.mocks.dart | 2 +- 15 files changed, 965 insertions(+), 1506 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 9fb31b2ceb8d..4f6b9266ab9d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -12,7 +12,6 @@ @interface FWFHTTPCookieStoreHostApiTests : XCTestCase @end @implementation FWFHTTPCookieStoreHostApiTests - - (void)testSetCookie API_AVAILABLE(ios(11.0)) { WKHTTPCookieStore *mockHttpCookieStore = OCMClassMock([WKHTTPCookieStore class]); @@ -22,9 +21,7 @@ - (void)testSetCookie API_AVAILABLE(ios(11.0)) { FWFHTTPCookieStoreHostApiImpl *hostApi = [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData makeWithProperties:@{ - [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] : @"hello" - }]; + FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData makeWithPropertyKeys:@[[FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName]] propertyValues:@[@"hello"]]; FlutterError *__block blockError; [hostApi setCookieForStoreWithIdentifier:@0 cookie:cookieData @@ -36,5 +33,4 @@ - (void)testSetCookie API_AVAILABLE(ios(11.0)) { completionHandler:OCMOCK_ANY]); XCTAssertNil(blockError); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index 2201f8c584a5..cc58c329acf5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -12,7 +12,6 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @end @implementation FWFWebViewConfigurationHostApiTests - - (void)testSetAllowsInlineMediaPlayback { WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([WKWebViewConfiguration class]); @@ -62,5 +61,4 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { WKAudiovisualMediaTypeVideo)]); XCTAssertNil(error); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index 2c868288e6ba..00d7f9f31df6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -12,7 +12,6 @@ @interface FWFWebsiteDataStoreHostApiTests : XCTestCase @end @implementation FWFWebsiteDataStoreHostApiTests - - (void)testRemoveDataOfTypes { WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([WKWebsiteDataStore class]); @@ -47,5 +46,4 @@ - (void)testRemoveDataOfTypes { XCTAssertEqualObjects(returnValue, @YES); XCTAssertNil(blockError); } - @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 2affad706632..683e793a4345 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -26,12 +26,12 @@ extern NSHTTPCookie *_Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData *data) { NSMutableDictionary *properties = [NSMutableDictionary dictionary]; - for (FWFNSHttpCookiePropertyKeyEnumData *key in data.properties.allKeys) { - NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(key); + for (int i = 0; i < data.propertyKeys.count; i++) { + NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(data.propertyKeys[i]); if (!cookieKey) { return nil; } - [properties setObject:data.properties[key] forKey:cookieKey]; + [properties setObject:data.propertyValues[i] forKey:cookieKey]; } return [NSHTTPCookie cookieWithProperties:properties]; } 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 2157088a47d5..647cb81cc3bd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -116,170 +116,106 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString *url; -@property(nonatomic, copy, nullable) NSString *httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString * url; +@property(nonatomic, copy, nullable) NSString * httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; +@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString *source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString * source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; +@property(nonatomic, strong) NSNumber * isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProperties: - (NSDictionary *)properties; -@property(nonatomic, strong) - NSDictionary *properties; ++ (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray * propertyKeys; +@property(nonatomic, strong) NSArray * propertyValues; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId - ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)secondsModifiedSinceEpoch - completion:(void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId - toValue:(nullable NSNumber *)value - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId - isOpaque:(NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId - isAllowed:(NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId - forTypes: - (NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - error: - (FlutterError *_Nullable *_Nonnull) - error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - handlerIdentifier:(NSNumber *)handlerInstanceid - ofName:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - name:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId - userScript:(FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId - isEnabled:(NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -288,126 +224,71 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId - functionIdentifier:(nullable NSNumber *)functionInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - URL:(nullable NSString *)url - completion:(void (^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - options: - (NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId - completion:(void (^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier: - (nullable NSNumber *)navigationDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId - request:(FWFNSUrlRequestData *)request - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId - HTMLString:(NSString *)string - baseURL:(nullable NSString *)baseUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId - fileURL:(NSString *)url - readAccessURL:(NSString *)readAccessUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId - assetKey:(NSString *)key - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId - isAllowed:(NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId - javaScriptString:(NSString *)javaScriptString - completion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -416,22 +297,16 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId - dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId - cookie:(FWFNSHttpCookieData *)cookie - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 41fa87e04713..dfbc0702ee6a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,25 +14,26 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; + @"code": (error.code ? error.code : [NSNull null]), + @"message": (error.message ? error.message : [NSNull null]), + @"details": (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; + @"result": (result ? result : [NSNull null]), + @"error": errorDict, + }; } -static id GetNullableObject(NSDictionary *dict, id key) { +static id GetNullableObject(NSDictionary* dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } + @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -68,14 +69,12 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -86,14 +85,12 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -104,14 +101,12 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -122,7 +117,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -138,14 +133,12 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -156,10 +149,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -177,22 +170,15 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", - (self.httpMethod ? self.httpMethod : [NSNull null]), - @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), - @"httpBody", - (self.allHttpHeaderFields ? self.allHttpHeaderFields - : [NSNull null]), - @"allHttpHeaderFields", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -202,53 +188,49 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = - [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", - (self.injectionTime ? [self.injectionTime toMap] - : [NSNull null]), - @"injectionTime", - (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), - @"isMainFrameOnly", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData -+ (instancetype)makeWithProperties: - (NSDictionary *)properties { - FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; - pigeonResult.properties = properties; ++ (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; + pigeonResult.propertyKeys = propertyKeys; + pigeonResult.propertyValues = propertyValues; return pigeonResult; } + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; - pigeonResult.properties = GetNullableObject(dict, @"properties"); - NSAssert(pigeonResult.properties != nil, @""); + pigeonResult.propertyKeys = GetNullableObject(dict, @"propertyKeys"); + NSAssert(pigeonResult.propertyKeys != nil, @""); + pigeonResult.propertyValues = GetNullableObject(dict, @"propertyValues"); + NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.properties ? self.properties : [NSNull null]), - @"properties", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), @"propertyKeys", (self.propertyValues ? self.propertyValues : [NSNull null]), @"propertyValues", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -256,11 +238,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -281,52 +265,43 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDefaultDataStoreWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -334,36 +309,30 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId - ofTypes:arg_dataTypes - modifiedSince:arg_secondsModifiedSinceEpoch - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -393,48 +362,42 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(contentOffsetForViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId - error:&error]; + NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: - toValue:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -443,20 +406,19 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -465,7 +427,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -495,73 +458,63 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId - error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier: - toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -571,34 +524,30 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, [api scrollByForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId - toX:arg_x - y:arg_y - error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -606,13 +555,15 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -620,11 +571,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -645,25 +598,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -671,87 +621,71 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId - isAllowed:arg_allow - error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." - @"setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: - forTypes:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId - forTypes:arg_types - error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -759,16 +693,18 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -776,14 +712,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -804,109 +743,86 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = - [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addScriptMessageHandlerForControllerWithIdentifier: - handlerIdentifier:ofName:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" - @"ofName:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - handlerIdentifier:arg_handlerInstanceid - ofName:arg_name - error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - name:arg_name - error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -914,46 +830,40 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: - userScript:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId - userScript:arg_userScript - error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllUserScriptsForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -961,7 +871,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -991,63 +902,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = - [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId - isEnabled:arg_enabled - error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1077,25 +978,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1103,7 +1001,8 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1133,25 +1032,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1159,33 +1055,29 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId - functionIdentifier:arg_functionInstanceId - error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1215,15 +1107,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFWKNavigationDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1235,35 +1127,29 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId - webViewIdentifier:(NSNumber *)arg_webViewInstanceId - URL:(nullable NSString *)arg_url - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, - (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, - (arg_url == nil) ? [NSNull null] : arg_url - ] - reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1271,11 +1157,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1296,25 +1184,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = - [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(disposeObjectWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1322,67 +1207,53 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addObserverForObjectWithIdentifier: - observerIdentifier:keyPath:options:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = - GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - options:arg_options - error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: - observerIdentifier:keyPath:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1412,15 +1283,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = - [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFFunctionFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1432,49 +1303,50 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1482,32 +1354,41 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1528,101 +1409,85 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_uiDelegateInstanceId - error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_navigationDelegateInstanceId - error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(URLForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1630,44 +1495,39 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: - error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId - error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: - request:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1676,75 +1536,63 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: - HTMLString:baseURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId - HTMLString:arg_string - baseURL:arg_baseUrl - error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId - fileURL:arg_url - readAccessURL:arg_readAccessUrl - error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: - assetKey:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1753,20 +1601,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1774,20 +1621,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1795,20 +1641,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1816,20 +1661,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1837,20 +1681,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(reloadWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1858,20 +1701,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(titleForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1879,85 +1721,71 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId - isAllowed:arg_allow - error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId - userAgent:arg_userAgent - error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId - javaScriptString:arg_javaScriptString - completion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1987,25 +1815,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec()]; + codec:FWFWKUIDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -2013,7 +1838,8 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2021,16 +1847,18 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2038,14 +1866,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2066,62 +1897,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: - dataStoreIdentifier:error:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId - dataStoreIdentifier:arg_websiteDataStoreInstanceId - error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: - cookie:completion:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_instanceId - cookie:arg_cookie - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } 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 04fdf4d9fa56..bd766e6cb544 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 @@ -221,9 +221,7 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: - (pigeonMap['allHttpHeaderFields'] as Map?)! - .cast(), + allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), ); } } @@ -252,8 +250,7 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode( - pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -262,22 +259,25 @@ class WKUserScriptData { class NSHttpCookieData { NSHttpCookieData({ - required this.properties, + required this.propertyKeys, + required this.propertyValues, }); - Map properties; + List propertyKeys; + List propertyValues; Object encode() { final Map pigeonMap = {}; - pigeonMap['properties'] = properties; + pigeonMap['propertyKeys'] = propertyKeys; + pigeonMap['propertyValues'] = propertyValues; return pigeonMap; } static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - properties: (pigeonMap['properties'] as Map?)! - .cast(), + propertyKeys: (pigeonMap['propertyKeys'] as List?)!.cast(), + propertyValues: (pigeonMap['propertyValues'] as List?)!.cast(), ); } } @@ -289,19 +289,20 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -310,30 +311,24 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -346,9 +341,7 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -357,8 +350,7 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -369,26 +361,18 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes( - int arg_instanceId, - List arg_dataTypes, - double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_dataTypes, - arg_secondsModifiedSinceEpoch - ]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -413,8 +397,7 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -422,8 +405,7 @@ class UIViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -432,8 +414,7 @@ class UIViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -451,18 +432,16 @@ class UIViewHostApi { Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -475,18 +454,16 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -506,29 +483,24 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -541,8 +513,7 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -551,8 +522,7 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -570,19 +540,16 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -593,22 +560,18 @@ class UIScrollViewHostApi { } } - Future setContentOffset( - int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -627,19 +590,20 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -648,18 +612,15 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -668,8 +629,7 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -680,23 +640,18 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -707,22 +662,18 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback( - int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -733,22 +684,18 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, - List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -767,25 +714,27 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -794,31 +743,24 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -829,23 +771,18 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler( - int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_handlerInstanceid, arg_name]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -856,22 +793,18 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler( - int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -884,9 +817,7 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -895,8 +826,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -907,23 +837,18 @@ class WKUserContentControllerHostApi { } } - Future addUserScript( - int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) - as Map?; + await channel.send([arg_instanceId, arg_userScript]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -936,9 +861,7 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -947,8 +870,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -968,30 +890,24 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1002,21 +918,18 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled( - int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1036,18 +949,15 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1056,8 +966,7 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1077,18 +986,15 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1097,8 +1003,7 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1109,23 +1014,18 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation( - int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1140,36 +1040,26 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } - abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = - _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation( - int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1184,19 +1074,20 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1205,8 +1096,7 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1214,8 +1104,7 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1224,8 +1113,7 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1236,28 +1124,18 @@ class NSObjectHostApi { } } - Future addObserver( - int arg_instanceId, - int arg_observerInstanceId, - String arg_keyPath, - List arg_options) async { + Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_observerInstanceId, - arg_keyPath, - arg_options - ]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1268,22 +1146,18 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, - String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( - [arg_instanceId, arg_observerInstanceId, arg_keyPath]) - as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1298,27 +1172,22 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } - abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1334,61 +1203,69 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1397,29 +1274,24 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create( - int arg_instanceId, int arg_configurationInstanceId) async { + Future create(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1430,22 +1302,18 @@ class WKWebViewHostApi { } } - Future setUIDelegate( - int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1456,22 +1324,18 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate( - int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_navigationDelegateInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1484,8 +1348,7 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1494,8 +1357,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1508,8 +1370,7 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1518,8 +1379,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1535,21 +1395,18 @@ class WKWebViewHostApi { } } - Future loadRequest( - int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1560,22 +1417,18 @@ class WKWebViewHostApi { } } - Future loadHtmlString( - int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) - as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1586,22 +1439,18 @@ class WKWebViewHostApi { } } - Future loadFileUrl( - int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_url, arg_readAccessUrl]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1614,18 +1463,16 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1638,8 +1485,7 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1648,8 +1494,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1667,8 +1512,7 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1677,8 +1521,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1696,8 +1539,7 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1706,8 +1548,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1720,8 +1561,7 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1730,8 +1570,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1744,8 +1583,7 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1754,8 +1592,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1768,8 +1605,7 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1778,8 +1614,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1790,22 +1625,18 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures( - int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1816,22 +1647,18 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent( - int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) - as Map?; + await channel.send([arg_instanceId, arg_userAgent]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1842,22 +1669,18 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript( - int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) - as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1877,8 +1700,7 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1886,8 +1708,7 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1896,8 +1717,7 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1916,25 +1736,27 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1943,30 +1765,24 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore( - int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_websiteDataStoreInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1977,21 +1793,18 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie( - int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h index 482c791d66d4..18449df95b77 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h @@ -1,45 +1,36 @@ /** - * Converts an FWFNSKeyValueObservingOptionsEnumData to an - * NSKeyValueObservingOptions. + * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. * - * @param data The data object containing information to create an - * NSKeyValueObservingOptions. + * @param data The data object containing information to create an NSKeyValueObservingOptions. * * @return An NSKeyValueObservingOptions or -1 if data could not be converted. */ -extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( - FWFNSKeyValueObservingOptionsEnumData* data); +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData* data); /** * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. * - * @param data The data object containing information to create an - * NSKeyValueChange. + * @param data The data object containing information to create an NSKeyValueChange. * * @return An NSKeyValueChange or -1 if data could not be converted. */ -extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData( - FWFNSKeyValueChangeEnumData* data); +extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData* data); /** * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. * - * @param data The data object containing information to create an - * NSKeyValueChangeKey. + * @param data The data object containing information to create an NSKeyValueChangeKey. * * @return An NSKeyValueChangeKey or -1 if data could not be converted. */ -extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData( - FWFNSKeyValueChangeKeyEnumData* data); +extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData* data); /** * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. * - * @param data The data object containing information to create an - * NSHttpCookiePropertyKey. + * @param data The data object containing information to create an NSHttpCookiePropertyKey. * * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. */ -extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( - FWFNSHttpCookiePropertyKeyEnumData* data); +extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData* data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json index 2d8dfe9ce310..bcd12b131722 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json @@ -1450,43 +1450,6 @@ } } ] - }, - { - "name": "WKNavigationActionPolicy", - "values": [ - { - "name": "allow", - "type": { - "name": "WKNavigationActionPolicy", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "cancel", - "type": { - "name": "WKNavigationActionPolicy", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] } ] } \ No newline at end of file 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 ea7f776047b3..0627e58d12c1 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 @@ -48,14 +48,12 @@ Iterable _toWKWebsiteDataTypeEnumData( extension _NSHttpCookieConverter on NSHttpCookie { NSHttpCookieData toNSHttpCookieData() { return NSHttpCookieData( - properties: properties.map( - (NSHttpCookiePropertyKey key, Object value) { - return MapEntry( - key.toNSHttpCookiePropertyKeyEnumData(), - value.toString(), - ); + propertyKeys: properties.keys.map( + (NSHttpCookiePropertyKey key) { + return key.toNSHttpCookiePropertyKeyEnumData(); }, - ), + ).toList(), + propertyValues: properties.values.map((_) => _).toList(), ); } } 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 c6fb23f7120d..e9a60045f70e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -207,7 +207,11 @@ class WKScriptMessageData { /// /// See https://developer.apple.com/documentation/foundation/nshttpcookie?language=objc. class NSHttpCookieData { - late Map properties; + // `NSDictionary`s are unable to use data classes as keys because they don't + // conform to `NSCopying`. This splits the map of properties into a list of + // keys and values with the ordered maintained. + late List propertyKeys; + late List propertyValues; } /// Mirror of WKWebsiteDataStore. @@ -336,7 +340,8 @@ abstract class WKUserContentControllerHostApi { @HostApi(dartHostTestHandler: 'TestWKPreferencesHostApi') abstract class WKPreferencesHostApi { @ObjCSelector( - 'createFromWebViewConfigurationWithIdentifier:configurationIdentifier:') + 'createFromWebViewConfigurationWithIdentifier:configurationIdentifier:', + ) void createFromWebViewConfiguration( int instanceId, int configurationInstanceId, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart index b8552c5d8157..7bd208eeac05 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/foundation/foundation_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart. // Do not manually edit this file. import 'package:mockito/mockito.dart' as _i1; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index c78527427360..908709c90134 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i4; 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 193b750fb86d..ae13ca9e6b6d 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 @@ -169,10 +169,10 @@ void main() { ).captured.single as NSHttpCookieData; expect( - cookie.properties.entries.single.key!.value, + cookie.propertyKeys.single!.value, NSHttpCookiePropertyKeyEnum.comment, ); - expect(cookie.properties.entries.single.value, 'aComment'); + expect(cookie.propertyValues.single, 'aComment'); }); }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index 39977d7c63f2..4ffb7d4c19d3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i3; From b09d7a644c70b29c25a0e69a93cb3a5e633b80e9 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 12:00:42 -0700 Subject: [PATCH 06/23] first create tests --- .../FWFWebViewConfigurationHostApiTests.m | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index cc58c329acf5..5c61932ff450 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -12,6 +12,34 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @end @implementation FWFWebViewConfigurationHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [instanceManager instanceForIdentifier:0]; + XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); + XCTAssertNil(error); +} + +- (void)testCreateFromWebViewWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + WKWebView *mockWebView = OCMClassMock([WKWebView class]); + OCMStub([mockWebView configuration]).andReturn(OCMClassMock([WKWebViewConfiguration class])); + [instanceManager addInstance:mockWebView withIdentifier:0]; + + FlutterError *error; + [hostApi createFromWebViewWithIdentifier:@1 webViewIdentifier:@0 error:&error]; + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); + XCTAssertNil(error); +} + - (void)testSetAllowsInlineMediaPlayback { WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([WKWebViewConfiguration class]); @@ -23,15 +51,9 @@ - (void)testSetAllowsInlineMediaPlayback { FlutterError *error; [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - isAllowed:@NO - error:&error]; - OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback - -:NO - - ]); + OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback:NO ]); XCTAssertNil(error); } From a13148bad54d886013ad42a1c527aee427168cab Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 15:30:52 -0700 Subject: [PATCH 07/23] create tests --- .../FWFHTTPCookieStoreHostApiTests.m | 16 ++++++++++++ .../RunnerTests/FWFPreferencesHostApiTests.m | 14 +++++++++- .../ios/RunnerTests/FWFWebViewHostApiTests.m | 14 ++++++++++ .../FWFWebsiteDataStoreHostApiTests.m | 26 +++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 4f6b9266ab9d..0b246bdb549f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -12,6 +12,22 @@ @interface FWFHTTPCookieStoreHostApiTests : XCTestCase @end @implementation FWFHTTPCookieStoreHostApiTests +- (void)testCreateFromWebsiteDataStoreWithIdentifier API_AVAILABLE(ios(11.0)) { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFHTTPCookieStoreHostApiImpl *hostApi = + [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + WKWebsiteDataStore *mockDataStore = OCMClassMock([WKWebsiteDataStore class]); + OCMStub([mockDataStore httpCookieStore]).andReturn(OCMClassMock([WKHTTPCookieStore class])); + [instanceManager addInstance:mockDataStore withIdentifier:0]; + + FlutterError *error; + [hostApi createFromWebsiteDataStoreWithIdentifier:@1 dataStoreIdentifier:@0 error:&error]; + WKHTTPCookieStore *cookieStore = (WKHTTPCookieStore *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([cookieStore isKindOfClass:[WKHTTPCookieStore class]]); + XCTAssertNil(error); +} + - (void)testSetCookie API_AVAILABLE(ios(11.0)) { WKHTTPCookieStore *mockHttpCookieStore = OCMClassMock([WKHTTPCookieStore class]); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index 31fa36849253..0117859eaf60 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -12,6 +12,19 @@ @interface FWFPreferencesHostApiTests : XCTestCase @end @implementation FWFPreferencesHostApiTests +- (void)testCreateFromWebViewConfigurationWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFPreferencesHostApiImpl *hostApi = + [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; + + FlutterError *error; + [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + WKPreferences *preferences = (WKPreferences *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); + XCTAssertNil(error); +} - (void)testSetJavaScriptEnabled { WKPreferences *mockPreferences = OCMClassMock([WKPreferences class]); @@ -31,5 +44,4 @@ - (void)testSetJavaScriptEnabled { ]); XCTAssertNil(error); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m index dc0c1ce593d2..ea2dffc2f41e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m @@ -12,6 +12,20 @@ @interface FWFWebViewHostApiTests : XCTestCase @end @implementation FWFWebViewHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebViewHostApiImpl *hostApi = + [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; + + FlutterError *error; + [hostApi createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + WKWebView *webView = (WKWebView *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([webView isKindOfClass:[WKWebView class]]); + XCTAssertNil(error); +} + - (void)testLoadRequest { FWFWebView *mockWebView = OCMClassMock([FWFWebView class]); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index 00d7f9f31df6..39ae5437ddd9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -12,6 +12,32 @@ @interface FWFWebsiteDataStoreHostApiTests : XCTestCase @end @implementation FWFWebsiteDataStoreHostApiTests +- (void)testCreateFromWebViewConfigurationWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebsiteDataStoreHostApiImpl *hostApi = + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; + + FlutterError *error; + [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([dataStore isKindOfClass:[WKWebsiteDataStore class]]); + XCTAssertNil(error); +} + +- (void)testCreateDefaultDataStoreWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebsiteDataStoreHostApiImpl *hostApi = + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createDefaultDataStoreWithIdentifier:@0 error:&error]; + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *) [instanceManager instanceForIdentifier:0]; + XCTAssertEqualObjects(dataStore, [WKWebsiteDataStore defaultDataStore]); + XCTAssertNil(error); +} + - (void)testRemoveDataOfTypes { WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([WKWebsiteDataStore class]); From be098efa03fc6adceb56d7bccf0e1e24ae36eee4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 16:34:32 -0700 Subject: [PATCH 08/23] more class implemented --- .../ios/Runner.xcodeproj/project.pbxproj | 10 +- .../FWFScriptMessageHandlerHostApiTests.m | 29 + .../FWFUserContentControllerHostApiTests.m | 136 +++++ .../ios/Classes/FWFDataConverters.h | 9 + .../ios/Classes/FWFDataConverters.m | 6 + .../Classes/FWFScriptMessageHandlerHostApi.h | 28 + .../Classes/FWFScriptMessageHandlerHostApi.m | 38 ++ .../Classes/FWFUserContentControllerHostApi.h | 22 + .../Classes/FWFUserContentControllerHostApi.m | 78 +++ .../ios/Classes/webview-umbrella.h | 2 + .../lib/src/web_kit/data_output.m | 168 +++--- .../lib/src/web_kit/output.h | 22 + .../lib/src/web_kit/output.m | 535 +++++++++++------- .../lib/src/web_kit/output_test.m | 390 ++++++++++--- .../lib/src/web_kit/template.m | 2 +- .../lib/src/web_kit/template_test.m | 28 + .../lib/src/web_kit/web_kit.dart | 2 +- .../lib/src/web_kit/web_kit.simple_ast.json | 2 +- .../lib/src/web_kit_webview_widget.dart | 5 +- .../test/src/ui_kit/ui_kit_test.mocks.dart | 2 +- .../test/src/web_kit/web_kit_test.mocks.dart | 2 +- .../web_kit_cookie_manager_test.mocks.dart | 2 +- .../web_kit_webview_widget_test.mocks.dart | 2 +- 23 files changed, 1131 insertions(+), 389 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index b25ededc20d0..85b05c64880f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -18,6 +18,8 @@ 8FB79B6928204E8700C101D3 /* FWFPreferencesHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */; }; 8FB79B6B28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */; }; 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */; }; + 8FB79B73282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */; }; + 8FB79B7928209D1300C101D3 /* FWFUserContentControllerHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -81,6 +83,8 @@ 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFPreferencesHostApiTests.m; sourceTree = ""; }; 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebsiteDataStoreHostApiTests.m; sourceTree = ""; }; 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewConfigurationHostApiTests.m; sourceTree = ""; }; + 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFScriptMessageHandlerHostApiTests.m; sourceTree = ""; }; + 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUserContentControllerHostApiTests.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -147,6 +151,8 @@ 8FB79B6828204E8700C101D3 /* FWFPreferencesHostApiTests.m */, 8FB79B6A28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m */, 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */, + 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */, + 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -447,7 +453,9 @@ 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */, 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */, 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */, + 8FB79B73282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m in Sources */, 334734012669319100DCC49E /* FLTWebViewTests.m in Sources */, + 8FB79B7928209D1300C101D3 /* FWFUserContentControllerHostApiTests.m in Sources */, 8FB79B6B28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m in Sources */, 334734022669319400DCC49E /* FLTWKNavigationDelegateTests.m in Sources */, 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m new file mode 100644 index 000000000000..f3887f095cfb --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFScriptMessageHandlerHostApiTests : XCTestCase +@end + +@implementation FWFScriptMessageHandlerHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFScriptMessageHandlerHostApiImpl *hostApi = + [[FWFScriptMessageHandlerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + FWFScriptMessageHandler *scriptMessageHandler = (FWFScriptMessageHandler*) + [instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([scriptMessageHandler conformsToProtocol:@protocol(WKScriptMessageHandler)]); + XCTAssertNil(error); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m new file mode 100644 index 000000000000..08a450ddd113 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m @@ -0,0 +1,136 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUserContentControllerHostApiTests : XCTestCase +@end + +@implementation FWFUserContentControllerHostApiTests +- (void)testCreateFromWebViewConfigurationWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; + + FlutterError *error; + [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + WKUserContentController *userContentController = (WKUserContentController *) [instanceManager instanceForIdentifier:1]; + XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); + XCTAssertNil(error); +} + +- (void)testAddScriptMessageHandler { + WKUserContentController*mockUserContentController = OCMClassMock([WKUserContentController class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + id mockMessageHandler = OCMProtocolMock(@protocol(WKScriptMessageHandler)); + [instanceManager addInstance:mockMessageHandler withIdentifier:1]; + + FlutterError *error; + [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 + handlerIdentifier:@1 + ofName:@"apple" + error:&error]; + OCMVerify([mockUserContentController addScriptMessageHandler +:mockMessageHandler + name:@"apple" + ]); + XCTAssertNil(error); +} + +- (void)testRemoveScriptMessageHandler { + WKUserContentController + *mockUserContentController = OCMClassMock([WKUserContentController class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 + name:@"apple" + error:&error]; + OCMVerify([mockUserContentController removeScriptMessageHandlerForName:@"apple"]); + XCTAssertNil(error); +} + +- (void)testRemoveAllScriptMessageHandlers API_AVAILABLE(ios(14.0)) { + WKUserContentController + *mockUserContentController = OCMClassMock([ + WKUserContentController + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 + + error:&error]; + OCMVerify([mockUserContentController removeAllScriptMessageHandlers]); + XCTAssertNil(error); +} + +- (void)testAddUserScript { + WKUserContentController + *mockUserContentController = OCMClassMock([ + WKUserContentController + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi addUserScriptForControllerWithIdentifier:@0 + userScript:[FWFWKUserScriptData makeWithSource:@"runAScript" injectionTime:[FWFWKUserScriptInjectionTimeEnumData makeWithValue:FWFWKUserScriptInjectionTimeEnumAtDocumentEnd] isMainFrameOnly:@YES] + error:&error]; + + OCMVerify([mockUserContentController addUserScript +:[OCMArg isKindOfClass:[WKUserScript class]]]); + XCTAssertNil(error); +} + +- (void)testRemoveAllUserScripts { + WKUserContentController + *mockUserContentController = OCMClassMock([ + WKUserContentController + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUserContentController withIdentifier:0]; + + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 + + error:&error]; + OCMVerify([mockUserContentController removeAllUserScripts]); + XCTAssertNil(error); +} +@end 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 1f5844573426..45aa3151a286 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -47,6 +47,15 @@ extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( FWFNSHttpCookiePropertyKeyEnumData *data); +/** + * Converts a WKUserScriptData to a WKUserScript. + * + * @param data The data object containing information to create an WKUserScript. + * + * @return A WKUserScript or nil if data could not be converted. + */ +extern WKUserScript* FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data); + /** * Converts an FWFWKUserScriptInjectionTimeEnumData to a WKUserScriptInjectionTime. * 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 683e793a4345..4931531957bc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -93,6 +93,12 @@ NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( return nil; } +extern WKUserScript* FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data) { + return [[WKUserScript alloc] initWithSource:data.source + injectionTime:FWFWKUserScriptInjectionTimeFromEnumData(data.injectionTime) + forMainFrameOnly:data.isMainFrameOnly.boolValue]; +} + WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData( FWFWKUserScriptInjectionTimeEnumData *data) { switch (data.value) { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h new file mode 100644 index 000000000000..7440862ce4e4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Implementation of WKScriptMessageHandler for FWFScriptMessageHandlerHostApiImpl. + */ +@interface FWFScriptMessageHandler : NSObject +@end + +/** + * Host api implementation for WKScriptMessageHandler. + * + * Handles creating WKScriptMessageHandler that intercommunicate with a paired Dart object. + */ +@interface FWFScriptMessageHandlerHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m new file mode 100644 index 000000000000..afe4914fceda --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -0,0 +1,38 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFScriptMessageHandlerHostApi.h" + + +@implementation FWFScriptMessageHandler +- (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message { + +} +@end + +@interface FWFScriptMessageHandlerHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScriptMessageHandlerHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (FWFScriptMessageHandler*)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { + return (FWFScriptMessageHandler*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] init]; + [self.instanceManager addInstance:scriptMessageHandler + withIdentifier:instanceId.longValue]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.h new file mode 100644 index 000000000000..f0e5a1383ac3 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for WKUserContentController. + * + * Handles creating WKUserContentController that intercommunicate with a paired Dart object. + */ +@interface FWFUserContentControllerHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m new file mode 100644 index 000000000000..32a3d1265ad9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -0,0 +1,78 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFUserContentControllerHostApi.h" + +@interface FWFUserContentControllerHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUserContentControllerHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (WKUserContentController*)userContentControllerForIdentifier:(NSNumber *)instanceId { + return (WKUserContentController*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager + addInstance:configuration.userContentController + withIdentifier:instanceId.longValue]; +} + + +- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId + handlerIdentifier:(nonnull NSNumber *)handler + ofName:(nonnull NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentControllerForIdentifier:instanceId] + addScriptMessageHandler:(id)[self.instanceManager instanceForIdentifier:handler.longValue] + name:name]; +} + +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId + name:(nonnull NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandlerForName +:name]; +} + +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + if (@available(iOS 14.0, *)) { + [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers + ]; + } else { + *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" + message:@"removeAllScriptMessageHandlers is only supported on versions 14+." + details:nil]; + } +} + +- (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId + userScript:(nonnull FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error { + [[self userContentControllerForIdentifier:instanceId] addUserScript:FWFWKUserScriptFromScriptData(userScript)]; +} + +- (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + [[self userContentControllerForIdentifier:instanceId] removeAllUserScripts]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index 92ae434f3edf..9f4fe592a249 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -17,3 +17,5 @@ #import #import #import +#import +#import diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m index 88aefa418f98..ea64444b790d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m @@ -1,18 +1,19 @@ -NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( - FWFNSKeyValueObservingOptionsEnumData *data) { +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { switch (data.value) { - case FWFNSKeyValueObservingOptionsEnumNewValue: - return NSKeyValueObservingOptionsNewValue; - - case FWFNSKeyValueObservingOptionsEnumOldValue: - return NSKeyValueObservingOptionsOldValue; - - case FWFNSKeyValueObservingOptionsEnumInitialValue: - return NSKeyValueObservingOptionsInitialValue; - - case FWFNSKeyValueObservingOptionsEnumPriorNotification: - return NSKeyValueObservingOptionsPriorNotification; + + case FWFNSKeyValueObservingOptionsEnum NewValue: + return NSKeyValueObservingOptions NewValue; + + case FWFNSKeyValueObservingOptionsEnum OldValue: + return NSKeyValueObservingOptions OldValue; + + case FWFNSKeyValueObservingOptionsEnum InitialValue: + return NSKeyValueObservingOptions InitialValue; + + case FWFNSKeyValueObservingOptionsEnum PriorNotification: + return NSKeyValueObservingOptions PriorNotification; + } return -1; @@ -20,17 +21,19 @@ NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data) { switch (data.value) { - case FWFNSKeyValueChangeEnumSetting: - return NSKeyValueChangeSetting; - - case FWFNSKeyValueChangeEnumInsertion: - return NSKeyValueChangeInsertion; - - case FWFNSKeyValueChangeEnumRemoval: - return NSKeyValueChangeRemoval; - - case FWFNSKeyValueChangeEnumReplacement: - return NSKeyValueChangeReplacement; + + case FWFNSKeyValueChangeEnum Setting: + return NSKeyValueChange Setting; + + case FWFNSKeyValueChangeEnum Insertion: + return NSKeyValueChange Insertion; + + case FWFNSKeyValueChangeEnum Removal: + return NSKeyValueChange Removal; + + case FWFNSKeyValueChangeEnum Replacement: + return NSKeyValueChange Replacement; + } return -1; @@ -38,69 +41,72 @@ NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *da NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data) { switch (data.value) { - case FWFNSKeyValueChangeKeyEnumIndexes: - return NSKeyValueChangeKeyIndexes; - - case FWFNSKeyValueChangeKeyEnumKind: - return NSKeyValueChangeKeyKind; - - case FWFNSKeyValueChangeKeyEnumNewValue: - return NSKeyValueChangeKeyNewValue; - - case FWFNSKeyValueChangeKeyEnumNotificationIsPrior: - return NSKeyValueChangeKeyNotificationIsPrior; - - case FWFNSKeyValueChangeKeyEnumOldValue: - return NSKeyValueChangeKeyOldValue; + + case FWFNSKeyValueChangeKeyEnum Indexes: + return NSKeyValueChangeKey Indexes; + + case FWFNSKeyValueChangeKeyEnum Kind: + return NSKeyValueChangeKey Kind; + + case FWFNSKeyValueChangeKeyEnum NewValue: + return NSKeyValueChangeKey NewValue; + + case FWFNSKeyValueChangeKeyEnum NotificationIsPrior: + return NSKeyValueChangeKey NotificationIsPrior; + + case FWFNSKeyValueChangeKeyEnum OldValue: + return NSKeyValueChangeKey OldValue; + } return -1; } -NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( - FWFNSHttpCookiePropertyKeyEnumData *data) { +NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { switch (data.value) { - case FWFNSHttpCookiePropertyKeyEnumComment: - return NSHttpCookiePropertyKeyComment; - - case FWFNSHttpCookiePropertyKeyEnumCommentUrl: - return NSHttpCookiePropertyKeyCommentUrl; - - case FWFNSHttpCookiePropertyKeyEnumDiscard: - return NSHttpCookiePropertyKeyDiscard; - - case FWFNSHttpCookiePropertyKeyEnumDomain: - return NSHttpCookiePropertyKeyDomain; - - case FWFNSHttpCookiePropertyKeyEnumExpires: - return NSHttpCookiePropertyKeyExpires; - - case FWFNSHttpCookiePropertyKeyEnumMaximumAge: - return NSHttpCookiePropertyKeyMaximumAge; - - case FWFNSHttpCookiePropertyKeyEnumName: - return NSHttpCookiePropertyKeyName; - - case FWFNSHttpCookiePropertyKeyEnumOriginUrl: - return NSHttpCookiePropertyKeyOriginUrl; - - case FWFNSHttpCookiePropertyKeyEnumPath: - return NSHttpCookiePropertyKeyPath; - - case FWFNSHttpCookiePropertyKeyEnumPort: - return NSHttpCookiePropertyKeyPort; - - case FWFNSHttpCookiePropertyKeyEnumSameSitePolicy: - return NSHttpCookiePropertyKeySameSitePolicy; - - case FWFNSHttpCookiePropertyKeyEnumSecure: - return NSHttpCookiePropertyKeySecure; - - case FWFNSHttpCookiePropertyKeyEnumValue: - return NSHttpCookiePropertyKeyValue; - - case FWFNSHttpCookiePropertyKeyEnumVersion: - return NSHttpCookiePropertyKeyVersion; + + case FWFNSHttpCookiePropertyKeyEnum Comment: + return NSHttpCookiePropertyKey Comment; + + case FWFNSHttpCookiePropertyKeyEnum CommentUrl: + return NSHttpCookiePropertyKey CommentUrl; + + case FWFNSHttpCookiePropertyKeyEnum Discard: + return NSHttpCookiePropertyKey Discard; + + case FWFNSHttpCookiePropertyKeyEnum Domain: + return NSHttpCookiePropertyKey Domain; + + case FWFNSHttpCookiePropertyKeyEnum Expires: + return NSHttpCookiePropertyKey Expires; + + case FWFNSHttpCookiePropertyKeyEnum MaximumAge: + return NSHttpCookiePropertyKey MaximumAge; + + case FWFNSHttpCookiePropertyKeyEnum Name: + return NSHttpCookiePropertyKey Name; + + case FWFNSHttpCookiePropertyKeyEnum OriginUrl: + return NSHttpCookiePropertyKey OriginUrl; + + case FWFNSHttpCookiePropertyKeyEnum Path: + return NSHttpCookiePropertyKey Path; + + case FWFNSHttpCookiePropertyKeyEnum Port: + return NSHttpCookiePropertyKey Port; + + case FWFNSHttpCookiePropertyKeyEnum SameSitePolicy: + return NSHttpCookiePropertyKey SameSitePolicy; + + case FWFNSHttpCookiePropertyKeyEnum Secure: + return NSHttpCookiePropertyKey Secure; + + case FWFNSHttpCookiePropertyKeyEnum Value: + return NSHttpCookiePropertyKey Value; + + case FWFNSHttpCookiePropertyKeyEnum Version: + return NSHttpCookiePropertyKey Version; + } return -1; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h index 3909b9c11b38..a48e318b58de 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h @@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN + + /** * Host api implementation for WKPreferences. * @@ -34,6 +36,8 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + + /** * Host api implementation for WKWebsiteDataStore. * @@ -57,6 +61,8 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + + /** * Host api implementation for WKHttpCookieStore. * @@ -80,6 +86,14 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + +/** + * Implementation of WKScriptMessageHandler for FWFScriptMessageHandlerHostApiImpl. + */ +@interface FWFScriptMessageHandler : NSObject +@end + + /** * Host api implementation for WKScriptMessageHandler. * @@ -103,6 +117,8 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + + /** * Host api implementation for WKUserContentController. * @@ -126,6 +142,8 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + + /** * Host api implementation for WKWebViewConfiguration. * @@ -149,12 +167,14 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + /** * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. */ @interface FWFUIDelegate : NSObject @end + /** * Host api implementation for WKUIDelegate. * @@ -178,12 +198,14 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN + /** * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. */ @interface FWFNavigationDelegate : NSObject @end + /** * Host api implementation for WKNavigationDelegate. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m index ed02c6c075e4..23f01b08b488 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m @@ -4,8 +4,10 @@ // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFPreferencesHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFPreferencesHostApi.h" + + @interface FWFPreferencesHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -21,26 +23,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKPreferences - - *)preferencesForIdentifier:(NSNumber *)instanceId { + + WKPreferences + + *)preferencesForIdentifier:(NSNumber *)instanceId { return ( - - WKPreferences - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + WKPreferences + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKPreferences - - *preferences = - - [[WKPreferences alloc] init]; - - [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; + + + WKPreferences + + * preferences + = + + + [[WKPreferences alloc] init]; + + [self.instanceManager addInstance:preferences + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -48,18 +56,24 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.preferences + withIdentifier:instanceId.longValue]; } -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId - enabled:(nonnull NSNumber *)enabled - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self preferencesForIdentifier:instanceId] setJavaScriptEnabled +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId + + enabled:( + nonnull NSNumber *)enabled + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self preferences ForIdentifier:instanceId] setJavaScriptEnabled :enabled - + + ]; } @@ -73,6 +87,8 @@ - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)ins #import "FWFWebViewConfigurationHostApi.h" #import "FWFWebsiteDataStoreHostApi.h" + + @interface FWFWebsiteDataStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -87,26 +103,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebsiteDataStore - - *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { + + WKWebsiteDataStore + + *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { return ( - - WKWebsiteDataStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + WKWebsiteDataStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebsiteDataStore - - *websiteDataStore = - - [[WKWebsiteDataStore alloc] init]; - - [self.instanceManager addInstance:websiteDataStore withIdentifier:instanceId.longValue]; + + + WKWebsiteDataStore + + * websiteDataStore + = + + + [[WKWebsiteDataStore alloc] init]; + + [self.instanceManager addInstance:websiteDataStore + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -114,24 +136,29 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.websiteDataStore - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.websiteDataStore + withIdentifier:instanceId.longValue]; } -- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - - dataTypes: - (nonnull NSArray *)dataTypes - - since:(nonnull NSNumber *)since - - error:(FlutterError *_Nullable *_Nonnull)error { - return [[self websiteDataStoreForIdentifier:instanceId] removeDataOfTypes - - :dataTypes - - since:since +- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + + dataTypes:( + nonnull NSArray *)dataTypes + + since:( + nonnull NSNumber *)since + + error:(FlutterError *_Nullable *_Nonnull)error { + return + [[self websiteDataStore ForIdentifier:instanceId] removeDataOfTypes + +:dataTypes + + + since:since + ]; } @@ -142,8 +169,10 @@ - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFHttpCookieStoreHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFHttpCookieStoreHostApi.h" + + @interface FWFHttpCookieStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -159,26 +188,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKHttpCookieStore - - *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { + + WKHttpCookieStore + + *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { return ( - - WKHttpCookieStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + WKHttpCookieStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKHttpCookieStore - - *httpCookieStore = - - [[WKHttpCookieStore alloc] init]; - - [self.instanceManager addInstance:httpCookieStore withIdentifier:instanceId.longValue]; + + + WKHttpCookieStore + + * httpCookieStore + = + + + [[WKHttpCookieStore alloc] init]; + + [self.instanceManager addInstance:httpCookieStore + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -186,19 +221,24 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.httpCookieStore - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.httpCookieStore + withIdentifier:instanceId.longValue]; } -- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId - - cookie:(nonnull NSHttpCookie *)cookie - error:(FlutterError *_Nullable *_Nonnull)error { - [[self httpCookieStoreForIdentifier:instanceId] setCookie +- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId + + cookie:( + nonnull NSHttpCookie *)cookie + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self httpCookieStore ForIdentifier:instanceId] setCookie :cookie - + + ]; } @@ -209,8 +249,13 @@ - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFScriptMessageHandlerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFScriptMessageHandlerHostApi.h" + + +@implementation FWFScriptMessageHandler +@end + @interface FWFScriptMessageHandlerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -226,26 +271,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKScriptMessageHandler - - *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { + FWFScriptMessageHandler + + + *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { return ( - - WKScriptMessageHandler - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + FWFScriptMessageHandler + + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKScriptMessageHandler - - *scriptMessageHandler = - - [[WKScriptMessageHandler alloc] init]; - - [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; + + FWFScriptMessageHandler + + + * scriptMessageHandler + = + + [[FWFScriptMessageHandler alloc] init]; + + + [self.instanceManager addInstance:scriptMessageHandler + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -253,10 +304,12 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.scriptMessageHandler - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.scriptMessageHandler + withIdentifier:instanceId.longValue]; } + @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -264,8 +317,10 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFUserContentControllerHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFUserContentControllerHostApi.h" + + @interface FWFUserContentControllerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -281,26 +336,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKUserContentController - - *)userContentControllerForIdentifier:(NSNumber *)instanceId { + + WKUserContentController + + *)userContentControllerForIdentifier:(NSNumber *)instanceId { return ( - - WKUserContentController - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + WKUserContentController + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKUserContentController - - *userContentController = - - [[WKUserContentController alloc] init]; - - [self.instanceManager addInstance:userContentController withIdentifier:instanceId.longValue]; + + + WKUserContentController + + * userContentController + = + + + [[WKUserContentController alloc] init]; + + [self.instanceManager addInstance:userContentController + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -308,67 +369,79 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.userContentController - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.userContentController + withIdentifier:instanceId.longValue]; } -- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - handler:(nonnull WKScriptMessageHandler *)handler - - name:(nonnull NSString *)name - - error: - (FlutterError *_Nullable *_Nonnull)error { - [[self userContentControllerForIdentifier:instanceId] addScriptMessageHandler - - :handler - - name:name +- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + handler:( + nonnull WKScriptMessageHandler *)handler + + name:( + nonnull NSString *)name + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentController ForIdentifier:instanceId] addScriptMessageHandler + +:handler + + + name:name + ]; } - (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - name:(nonnull NSString *)name - - error:(FlutterError *_Nullable *_Nonnull) - error { - [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandler + + name:( + nonnull NSString *)name + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentController ForIdentifier:instanceId] removeScriptMessageHandler :name - + + ]; } - (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentController ForIdentifier:instanceId] removeAllScriptMessageHandlers - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers - + ]; } - (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - userScript:(nonnull WKUserScript *)userScript - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self userContentControllerForIdentifier:instanceId] addUserScript + + userScript:( + nonnull WKUserScript *)userScript + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentController ForIdentifier:instanceId] addUserScript :userScript - + + ]; } - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self userContentController ForIdentifier:instanceId] removeAllUserScripts - error:(FlutterError *_Nullable *_Nonnull)error { - [[self userContentControllerForIdentifier:instanceId] removeAllUserScripts - + ]; } @@ -380,6 +453,9 @@ - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)inst #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFWebViewConfigurationHostApi.h" + + @interface FWFWebViewConfigurationHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -395,26 +471,32 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebViewConfiguration - - *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + + WKWebViewConfiguration + + *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { return ( - - WKWebViewConfiguration - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + WKWebViewConfiguration + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration - - *webViewConfiguration = - - [[WKWebViewConfiguration alloc] init]; - - [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; + + + WKWebViewConfiguration + + * webViewConfiguration + = + + + [[WKWebViewConfiguration alloc] init]; + + [self.instanceManager addInstance:webViewConfiguration + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -422,39 +504,39 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.webViewConfiguration - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.webViewConfiguration + withIdentifier:instanceId.longValue]; } -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - allow:(nonnull NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self webViewConfigurationForIdentifier:instanceId] setAllowsInlineMediaPlayback +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + + allow:( + nonnull NSNumber *)allow + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self webViewConfiguration ForIdentifier:instanceId] setAllowsInlineMediaPlayback :allow - + + ]; } -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - types: - (nonnull NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self webViewConfigurationForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + + types:( + nonnull NSArray *)types + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self webViewConfiguration ForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback :types - + + ]; } @@ -465,12 +547,14 @@ - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNu // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFUIDelegateHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFUIDelegateHostApi.h" + @implementation FWFUIDelegate @end + @interface FWFUIDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -484,25 +568,33 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (FWFUIDelegate - - *)uIDelegateForIdentifier:(NSNumber *)instanceId { +- ( + FWFUIDelegate + + + *)uIDelegateForIdentifier:(NSNumber *)instanceId { return ( - + FWFUIDelegate - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { + FWFUIDelegate - - *uIDelegate = - - [[FWFUIDelegate alloc] init]; - - [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; + + + * uIDelegate + = + + [[FWFUIDelegate alloc] init]; + + + [self.instanceManager addInstance:uIDelegate + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -510,9 +602,12 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.uIDelegate withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.uIDelegate + withIdentifier:instanceId.longValue]; } + @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -520,12 +615,14 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFNavigationDelegateHostApi.h" #import "FWFWebViewConfigurationHostApi.h" +#import "FWFNavigationDelegateHostApi.h" + @implementation FWFNavigationDelegate @end + @interface FWFNavigationDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -539,25 +636,33 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (FWFNavigationDelegate - - *)navigationDelegateForIdentifier:(NSNumber *)instanceId { +- ( + FWFNavigationDelegate + + + *)navigationDelegateForIdentifier:(NSNumber *)instanceId { return ( - + FWFNavigationDelegate - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { + FWFNavigationDelegate - - *navigationDelegate = - - [[FWFNavigationDelegate alloc] init]; - - [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; + + + * navigationDelegate + = + + [[FWFNavigationDelegate alloc] init]; + + + [self.instanceManager addInstance:navigationDelegate + withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -565,8 +670,10 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.navigationDelegate - withIdentifier:instanceId.longValue]; + [self.instanceManager + addInstance:configuration.navigationDelegate + withIdentifier:instanceId.longValue]; } + @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m index 0776d5bb4ace..638b8946c136 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m @@ -13,9 +13,33 @@ @interface FWFPreferencesHostApiTests : XCTestCase @end @implementation FWFPreferencesHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFPreferencesHostApiImpl *hostApi = + [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; -- (void)testSetJavaScriptEnabled { - WKPreferences + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + WKPreferences + *preferences = ( + + + WKPreferences + *) [instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); + + XCTAssertNil(error); +} + + +- (void)test SetJavaScriptEnabled { + + + WKPreferences *mockPreferences = OCMClassMock([ @@ -27,18 +51,20 @@ - (void)testSetJavaScriptEnabled { [instanceManager addInstance:mockPreferences withIdentifier:0]; FWFPreferencesHostApiImpl *hostApi = - [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFPreferencesHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 - - enabled:aValue - - error:&error]; + + enabled:aValue + + error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled :aValue - + + ]); XCTAssertNil(error); } @@ -59,9 +85,33 @@ @interface FWFWebsiteDataStoreHostApiTests : XCTestCase @end @implementation FWFWebsiteDataStoreHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebsiteDataStoreHostApiImpl *hostApi = + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; -- (void)testRemoveDataOfTypes { - WKWebsiteDataStore + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + WKWebsiteDataStore + *websiteDataStore = ( + + + WKWebsiteDataStore + *) [instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue([websiteDataStore isKindOfClass:[WKWebsiteDataStore class]]); + + XCTAssertNil(error); +} + + +- (void)test RemoveDataOfTypes { + + + WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([ @@ -73,22 +123,24 @@ - (void)testRemoveDataOfTypes { [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; FWFWebsiteDataStoreHostApiImpl *hostApi = - [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFWebsiteDataStoreHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeDataFromDataStoreWithIdentifier:@0 - - dataTypes:aValue - - since:aValue - - error:&error]; + + dataTypes:aValue + + since:aValue + + error:&error]; OCMVerify([mockWebsiteDataStore removeDataOfTypes - :aValue - - since:aValue - +:aValue + + + since:aValue + ]); XCTAssertNil(error); } @@ -109,9 +161,33 @@ @interface FWFHttpCookieStoreHostApiTests : XCTestCase @end @implementation FWFHttpCookieStoreHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFHttpCookieStoreHostApiImpl *hostApi = + [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; -- (void)testSetCookie { - WKHttpCookieStore + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + WKHttpCookieStore + *httpCookieStore = ( + + + WKHttpCookieStore + *) [instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue([httpCookieStore isKindOfClass:[WKHttpCookieStore class]]); + + XCTAssertNil(error); +} + + +- (void)test SetCookie { + + + WKHttpCookieStore *mockHttpCookieStore = OCMClassMock([ @@ -123,18 +199,20 @@ - (void)testSetCookie { [instanceManager addInstance:mockHttpCookieStore withIdentifier:0]; FWFHttpCookieStoreHostApiImpl *hostApi = - [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFHttpCookieStoreHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setCookieForStoreWithIdentifier:@0 - - cookie:aValue - - error:&error]; + + cookie:aValue + + error:&error]; OCMVerify([mockHttpCookieStore setCookie :aValue - + + ]); XCTAssertNil(error); } @@ -155,6 +233,30 @@ @interface FWFScriptMessageHandlerHostApiTests : XCTestCase @end @implementation FWFScriptMessageHandlerHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFScriptMessageHandlerHostApiImpl *hostApi = + [[FWFScriptMessageHandlerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + FWFScriptMessageHandler + + + *scriptMessageHandler = ( + + FWFScriptMessageHandler + + + *) [instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([scriptMessageHandler conformsToProtocol:@protocol(WKScriptMessageHandler)]); + + + XCTAssertNil(error); +} + @end @@ -172,9 +274,33 @@ @interface FWFUserContentControllerHostApiTests : XCTestCase @end @implementation FWFUserContentControllerHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; -- (void)testAddScriptMessageHandler { - WKUserContentController + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + WKUserContentController + *userContentController = ( + + + WKUserContentController + *) [instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); + + XCTAssertNil(error); +} + + +- (void)test AddScriptMessageHandler { + + + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -186,28 +312,32 @@ - (void)testAddScriptMessageHandler { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 - - handler:aValue - - name:aValue - - error:&error]; + + handler:aValue + + name:aValue + + error:&error]; OCMVerify([mockUserContentController addScriptMessageHandler - :aValue - - name:aValue - +:aValue + + + name:aValue + ]); XCTAssertNil(error); } -- (void)testRemoveScriptMessageHandler { - WKUserContentController +- (void)test RemoveScriptMessageHandler { + + + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -219,24 +349,28 @@ - (void)testRemoveScriptMessageHandler { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 - - name:aValue - - error:&error]; + + name:aValue + + error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandler :aValue - + + ]); XCTAssertNil(error); } -- (void)testRemoveAllScriptMessageHandlers { - WKUserContentController +- (void)test RemoveAllScriptMessageHandlers { + + + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -248,20 +382,24 @@ - (void)testRemoveAllScriptMessageHandlers { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers + ]); XCTAssertNil(error); } -- (void)testAddUserScript { - WKUserContentController +- (void)test AddUserScript { + + + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -273,24 +411,28 @@ - (void)testAddUserScript { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi addUserScriptForControllerWithIdentifier:@0 - - userScript:aValue - - error:&error]; + + userScript:aValue + + error:&error]; OCMVerify([mockUserContentController addUserScript :aValue - + + ]); XCTAssertNil(error); } -- (void)testRemoveAllUserScripts { - WKUserContentController +- (void)test RemoveAllUserScripts { + + + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -302,14 +444,16 @@ - (void)testRemoveAllUserScripts { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllUserScripts + ]); XCTAssertNil(error); } @@ -330,9 +474,33 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @end @implementation FWFWebViewConfigurationHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFWebViewConfigurationHostApiImpl *hostApi = + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; -- (void)testSetAllowsInlineMediaPlayback { - WKWebViewConfiguration + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + WKWebViewConfiguration + *webViewConfiguration = ( + + + WKWebViewConfiguration + *) [instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue([webViewConfiguration isKindOfClass:[WKWebViewConfiguration class]]); + + XCTAssertNil(error); +} + + +- (void)test SetAllowsInlineMediaPlayback { + + + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -344,24 +512,28 @@ - (void)testSetAllowsInlineMediaPlayback { [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFWebViewConfigurationHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - - allow:aValue - - error:&error]; + + allow:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback :aValue - + + ]); XCTAssertNil(error); } -- (void)testSetMediaTypesRequiringUserActionForPlayback { - WKWebViewConfiguration +- (void)test SetMediaTypesRequiringUserActionForPlayback { + + + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -373,18 +545,20 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWFWebViewConfigurationHostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 - - types:aValue - - error:&error]; + + types:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback :aValue - + + ]); XCTAssertNil(error); } @@ -405,6 +579,30 @@ @interface FWFUIDelegateHostApiTests : XCTestCase @end @implementation FWFUIDelegateHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFUIDelegateHostApiImpl *hostApi = + [[FWFUIDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + FWFUIDelegate + + + *uIDelegate = ( + + FWFUIDelegate + + + *) [instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([uIDelegate conformsToProtocol:@protocol(WKUIDelegate)]); + + + XCTAssertNil(error); +} + @end @@ -422,5 +620,29 @@ @interface FWFNavigationDelegateHostApiTests : XCTestCase @end @implementation FWFNavigationDelegateHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFNavigationDelegateHostApiImpl *hostApi = + [[FWFNavigationDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + FWFNavigationDelegate + + + *navigationDelegate = ( + + FWFNavigationDelegate + + + *) [instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]); + + + XCTAssertNil(error); +} + @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m index 057c9d21557f..13e8bcddfb7e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m @@ -32,7 +32,7 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { __name__ /**/ *)/*replace :case=camel customValues_nameWithoutPrefix*/ name - /**/ ForIdentifier:(NSNumber *)instanceId { + /**/ForIdentifier:(NSNumber *)instanceId { return ( /*if customValues_isProtocol*/ FWF__customValues_nameWithoutPrefix__ diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m index 080b0022acd4..1f7cf508d88d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m @@ -13,6 +13,34 @@ @interface FWF__customValues_nameWithoutPrefix__HostApiTests : XCTestCase @end @implementation FWF__customValues_nameWithoutPrefix__HostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWF__customValues_nameWithoutPrefix__HostApiImpl *hostApi = + [[FWF__customValues_nameWithoutPrefix__HostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + /*if customValues_isProtocol*/ + FWF__class_customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ /**/ + */*replace :case=camel customValues_nameWithoutPrefix*/name/**/ = ( + /*if customValues_isProtocol*/ + FWF__class_customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ /**/ + *) [instanceManager instanceForIdentifier:0]; + /*if customValues_isProtocol*/ + XCTAssertTrue([/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ conformsToProtocol:@protocol(__name__)]); + /**/ + /*if! customValues_isProtocol*/ + XCTAssertTrue([/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ isKindOfClass:[__name__ class]]); + /**/ + XCTAssertNil(error); +} + /*iterate methods method*/ - (void)test /*replace :case=pascal name*/ methodName /**/ { /*if class_customValues_isProtocol*/ 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 0dc2d54ad1b6..5174352daf35 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 @@ -389,7 +389,7 @@ class WKHttpCookieStore extends NSObject { /// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc) @SimpleClassAnnotation(customValues: { 'nameWithoutPrefix': 'ScriptMessageHandler', - 'isProtocol': false, + 'isProtocol': true, }) class WKScriptMessageHandler { /// Constructs a [WKScriptMessageHandler]. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json index bcd12b131722..1b5fcc271e61 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json @@ -490,7 +490,7 @@ "fields": [], "customValues": { "nameWithoutPrefix": "ScriptMessageHandler", - "isProtocol": false + "isProtocol": true } }, { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart index de295932d22b..083c5ebc702f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart @@ -517,8 +517,9 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { Set removedJavaScriptChannels = const {}, }) async { webView.configuration.userContentController.removeAllUserScripts(); - webView.configuration.userContentController - .removeAllScriptMessageHandlers(); + _scriptMessageHandlers.keys.forEach( + webView.configuration.userContentController.removeScriptMessageHandler, + ); removedJavaScriptChannels.forEach(_scriptMessageHandlers.remove); final Set remainingNames = _scriptMessageHandlers.keys.toSet(); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index 908709c90134..c78527427360 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i4; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index 4ffb7d4c19d3..39977d7c63f2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i3; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart index 8d7751da785f..b35256d4a2e0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart. +// in webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart. // Do not manually edit this file. import 'dart:async' as _i3; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart index 066f33a9774e..b5c62fab1a01 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart. +// in webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart. // Do not manually edit this file. import 'dart:async' as _i5; From 76cb1b8de286930aa9e1983a9e0b3dea577c1a15 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 16:45:02 -0700 Subject: [PATCH 09/23] uidelegate and navigation delgate and formatting --- .../ios/Runner.xcodeproj/project.pbxproj | 8 + .../FWFHTTPCookieStoreHostApiTests.m | 13 +- .../FWFNavigationDelegateHostApiTests.m | 28 + .../RunnerTests/FWFPreferencesHostApiTests.m | 6 +- .../FWFScriptMessageHandlerHostApiTests.m | 8 +- .../RunnerTests/FWFUIDelegateHostApiTests.m | 28 + .../FWFUserContentControllerHostApiTests.m | 91 +- .../FWFWebViewConfigurationHostApiTests.m | 14 +- .../ios/RunnerTests/FWFWebViewHostApiTests.m | 6 +- .../FWFWebsiteDataStoreHostApiTests.m | 10 +- .../ios/Classes/FWFDataConverters.h | 2 +- .../ios/Classes/FWFDataConverters.m | 12 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 273 +++- .../ios/Classes/FWFGeneratedWebKitApis.m | 1315 ++++++++++------- .../Classes/FWFNavigationDelegateHostApi.h | 28 + .../Classes/FWFNavigationDelegateHostApi.m | 33 + .../Classes/FWFScriptMessageHandlerHostApi.m | 15 +- .../ios/Classes/FWFUIDelegateHostApi.h | 28 + .../ios/Classes/FWFUIDelegateHostApi.m | 33 + .../Classes/FWFUserContentControllerHostApi.m | 58 +- .../ios/Classes/webview-umbrella.h | 6 +- .../lib/src/common/web_kit.pigeon.dart | 754 ++++++---- .../lib/src/web_kit/data_output.h | 27 +- .../lib/src/web_kit/data_output.m | 60 +- .../lib/src/web_kit/output.h | 16 - .../lib/src/web_kit/output.m | 528 +++---- .../lib/src/web_kit/output_test.m | 350 ++--- .../lib/src/web_kit/template.m | 2 +- .../lib/src/web_kit/template_test.m | 30 +- 29 files changed, 2139 insertions(+), 1643 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 85b05c64880f..53edc88a4097 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -20,6 +20,8 @@ 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */; }; 8FB79B73282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */; }; 8FB79B7928209D1300C101D3 /* FWFUserContentControllerHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */; }; + 8FB79B832820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */; }; + 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -85,6 +87,8 @@ 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewConfigurationHostApiTests.m; sourceTree = ""; }; 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFScriptMessageHandlerHostApiTests.m; sourceTree = ""; }; 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUserContentControllerHostApiTests.m; sourceTree = ""; }; + 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFNavigationDelegateHostApiTests.m; sourceTree = ""; }; + 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUIDelegateHostApiTests.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -153,6 +157,8 @@ 8FB79B6C2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m */, 8FB79B72282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m */, 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */, + 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */, + 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -451,6 +457,7 @@ buildActionMask = 2147483647; files = ( 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */, + 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */, 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */, 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */, 8FB79B73282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m in Sources */, @@ -460,6 +467,7 @@ 334734022669319400DCC49E /* FLTWKNavigationDelegateTests.m in Sources */, 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */, 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */, + 8FB79B832820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m in Sources */, E43693B527512C0F00382F85 /* FLTCookieManagerTests.m in Sources */, 8FB79B6928204E8700C101D3 /* FWFPreferencesHostApiTests.m in Sources */, ); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 0b246bdb549f..315640a99247 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -12,18 +12,18 @@ @interface FWFHTTPCookieStoreHostApiTests : XCTestCase @end @implementation FWFHTTPCookieStoreHostApiTests -- (void)testCreateFromWebsiteDataStoreWithIdentifier API_AVAILABLE(ios(11.0)) { +- (void)testCreateFromWebsiteDataStoreWithIdentifier API_AVAILABLE(ios(11.0)) { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFHTTPCookieStoreHostApiImpl *hostApi = [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + WKWebsiteDataStore *mockDataStore = OCMClassMock([WKWebsiteDataStore class]); OCMStub([mockDataStore httpCookieStore]).andReturn(OCMClassMock([WKHTTPCookieStore class])); [instanceManager addInstance:mockDataStore withIdentifier:0]; - + FlutterError *error; [hostApi createFromWebsiteDataStoreWithIdentifier:@1 dataStoreIdentifier:@0 error:&error]; - WKHTTPCookieStore *cookieStore = (WKHTTPCookieStore *) [instanceManager instanceForIdentifier:1]; + WKHTTPCookieStore *cookieStore = (WKHTTPCookieStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([cookieStore isKindOfClass:[WKHTTPCookieStore class]]); XCTAssertNil(error); } @@ -37,7 +37,10 @@ - (void)testSetCookie API_AVAILABLE(ios(11.0)) { FWFHTTPCookieStoreHostApiImpl *hostApi = [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData makeWithPropertyKeys:@[[FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName]] propertyValues:@[@"hello"]]; + FWFNSHttpCookieData *cookieData = [FWFNSHttpCookieData + makeWithPropertyKeys:@[ [FWFNSHttpCookiePropertyKeyEnumData + makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] ] + propertyValues:@[ @"hello" ]]; FlutterError *__block blockError; [hostApi setCookieForStoreWithIdentifier:@0 cookie:cookieData diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m new file mode 100644 index 000000000000..02e473f8b795 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFNavigationDelegateHostApiTests : XCTestCase +@end + +@implementation FWFNavigationDelegateHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFNavigationDelegateHostApiImpl *hostApi = + [[FWFNavigationDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + FWFNavigationDelegate *navigationDelegate = + (FWFNavigationDelegate *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]); + XCTAssertNil(error); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index 0117859eaf60..82b68affae06 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -16,12 +16,12 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFPreferencesHostApiImpl *hostApi = [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; - + FlutterError *error; [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; - WKPreferences *preferences = (WKPreferences *) [instanceManager instanceForIdentifier:1]; + WKPreferences *preferences = (WKPreferences *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m index f3887f095cfb..cb8348fc4702 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m @@ -19,10 +19,10 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - FWFScriptMessageHandler *scriptMessageHandler = (FWFScriptMessageHandler*) - [instanceManager instanceForIdentifier:0]; - + + FWFScriptMessageHandler *scriptMessageHandler = + (FWFScriptMessageHandler *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([scriptMessageHandler conformsToProtocol:@protocol(WKScriptMessageHandler)]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m new file mode 100644 index 000000000000..c17fcbe4bf81 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUIDelegateHostApiTests : XCTestCase +@end + +@implementation FWFUIDelegateHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFUIDelegateHostApiImpl *hostApi = + [[FWFUIDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + FWFUIDelegate *delegate = (FWFUIDelegate *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([delegate conformsToProtocol:@protocol(WKUIDelegate)]); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m index 08a450ddd113..09c6617786ca 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m @@ -16,120 +16,115 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFUserContentControllerHostApiImpl *hostApi = [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; - + FlutterError *error; [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; - WKUserContentController *userContentController = (WKUserContentController *) [instanceManager instanceForIdentifier:1]; + WKUserContentController *userContentController = + (WKUserContentController *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); XCTAssertNil(error); } - (void)testAddScriptMessageHandler { - WKUserContentController*mockUserContentController = OCMClassMock([WKUserContentController class]); + WKUserContentController *mockUserContentController = + OCMClassMock([WKUserContentController class]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockUserContentController withIdentifier:0]; - FWFUserContentControllerHostApiImpl *hostApi = [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; - - id mockMessageHandler = OCMProtocolMock(@protocol(WKScriptMessageHandler)); + FWFUserContentControllerHostApiImpl *hostApi = + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + id mockMessageHandler = + OCMProtocolMock(@protocol(WKScriptMessageHandler)); [instanceManager addInstance:mockMessageHandler withIdentifier:1]; FlutterError *error; [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 - handlerIdentifier:@1 - ofName:@"apple" - error:&error]; - OCMVerify([mockUserContentController addScriptMessageHandler -:mockMessageHandler - name:@"apple" - ]); + handlerIdentifier:@1 + ofName:@"apple" + error:&error]; + OCMVerify([mockUserContentController addScriptMessageHandler:mockMessageHandler name:@"apple"]); XCTAssertNil(error); } - (void)testRemoveScriptMessageHandler { - WKUserContentController - *mockUserContentController = OCMClassMock([WKUserContentController class]); + WKUserContentController *mockUserContentController = + OCMClassMock([WKUserContentController class]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 - name:@"apple" - error:&error]; + [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 name:@"apple" error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandlerForName:@"apple"]); XCTAssertNil(error); } - (void)testRemoveAllScriptMessageHandlers API_AVAILABLE(ios(14.0)) { - WKUserContentController - *mockUserContentController = OCMClassMock([ - WKUserContentController - class]); + WKUserContentController *mockUserContentController = + OCMClassMock([WKUserContentController class]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - error:&error]; + error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers]); XCTAssertNil(error); } - (void)testAddUserScript { - WKUserContentController - *mockUserContentController = OCMClassMock([ - WKUserContentController - class]); + WKUserContentController *mockUserContentController = + OCMClassMock([WKUserContentController class]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi addUserScriptForControllerWithIdentifier:@0 - userScript:[FWFWKUserScriptData makeWithSource:@"runAScript" injectionTime:[FWFWKUserScriptInjectionTimeEnumData makeWithValue:FWFWKUserScriptInjectionTimeEnumAtDocumentEnd] isMainFrameOnly:@YES] - error:&error]; - - OCMVerify([mockUserContentController addUserScript -:[OCMArg isKindOfClass:[WKUserScript class]]]); + [hostApi + addUserScriptForControllerWithIdentifier:@0 + userScript: + [FWFWKUserScriptData + makeWithSource:@"runAScript" + injectionTime: + [FWFWKUserScriptInjectionTimeEnumData + makeWithValue: + FWFWKUserScriptInjectionTimeEnumAtDocumentEnd] + isMainFrameOnly:@YES] + error:&error]; + + OCMVerify([mockUserContentController addUserScript:[OCMArg isKindOfClass:[WKUserScript class]]]); XCTAssertNil(error); } - (void)testRemoveAllUserScripts { - WKUserContentController - *mockUserContentController = OCMClassMock([ - WKUserContentController - class]); + WKUserContentController *mockUserContentController = + OCMClassMock([WKUserContentController class]); FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - error:&error]; + error:&error]; OCMVerify([mockUserContentController removeAllUserScripts]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index 5c61932ff450..dab10799891b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -16,10 +16,11 @@ - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFWebViewConfigurationHostApiImpl *hostApi = [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [instanceManager instanceForIdentifier:0]; + WKWebViewConfiguration *configuration = + (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:0]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); XCTAssertNil(error); } @@ -28,14 +29,15 @@ - (void)testCreateFromWebViewWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFWebViewConfigurationHostApiImpl *hostApi = [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + WKWebView *mockWebView = OCMClassMock([WKWebView class]); OCMStub([mockWebView configuration]).andReturn(OCMClassMock([WKWebViewConfiguration class])); [instanceManager addInstance:mockWebView withIdentifier:0]; - + FlutterError *error; [hostApi createFromWebViewWithIdentifier:@1 webViewIdentifier:@0 error:&error]; - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *) [instanceManager instanceForIdentifier:1]; + WKWebViewConfiguration *configuration = + (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); XCTAssertNil(error); } @@ -53,7 +55,7 @@ - (void)testSetAllowsInlineMediaPlayback { [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 isAllowed:@NO error:&error]; - OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback:NO ]); + OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback:NO]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m index ea2dffc2f41e..87960c07ee5e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m @@ -16,12 +16,12 @@ - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFWebViewHostApiImpl *hostApi = [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; - + FlutterError *error; [hostApi createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; - WKWebView *webView = (WKWebView *) [instanceManager instanceForIdentifier:1]; + WKWebView *webView = (WKWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([webView isKindOfClass:[WKWebView class]]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index 39ae5437ddd9..c754f78551b9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -16,12 +16,12 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFWebsiteDataStoreHostApiImpl *hostApi = [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + [instanceManager addInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; - + FlutterError *error; [hostApi createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; - WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *) [instanceManager instanceForIdentifier:1]; + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([dataStore isKindOfClass:[WKWebsiteDataStore class]]); XCTAssertNil(error); } @@ -30,10 +30,10 @@ - (void)testCreateDefaultDataStoreWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFWebsiteDataStoreHostApiImpl *hostApi = [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + FlutterError *error; [hostApi createDefaultDataStoreWithIdentifier:@0 error:&error]; - WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *) [instanceManager instanceForIdentifier:0]; + WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:0]; XCTAssertEqualObjects(dataStore, [WKWebsiteDataStore defaultDataStore]); XCTAssertNil(error); } 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 45aa3151a286..854bb7e06c9e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -54,7 +54,7 @@ extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( * * @return A WKUserScript or nil if data could not be converted. */ -extern WKUserScript* FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data); +extern WKUserScript *FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data); /** * Converts an FWFWKUserScriptInjectionTimeEnumData to a WKUserScriptInjectionTime. 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 4931531957bc..b47a6475df4e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -27,7 +27,8 @@ extern NSHTTPCookie *_Nullable FWFNSHTTPCookieFromCookieData(FWFNSHttpCookieData *data) { NSMutableDictionary *properties = [NSMutableDictionary dictionary]; for (int i = 0; i < data.propertyKeys.count; i++) { - NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(data.propertyKeys[i]); + NSHTTPCookiePropertyKey cookieKey = + FWFNSHTTPCookiePropertyKeyFromEnumData(data.propertyKeys[i]); if (!cookieKey) { return nil; } @@ -93,10 +94,11 @@ NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( return nil; } -extern WKUserScript* FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data) { - return [[WKUserScript alloc] initWithSource:data.source - injectionTime:FWFWKUserScriptInjectionTimeFromEnumData(data.injectionTime) - forMainFrameOnly:data.isMainFrameOnly.boolValue]; +extern WKUserScript *FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data) { + return [[WKUserScript alloc] + initWithSource:data.source + injectionTime:FWFWKUserScriptInjectionTimeFromEnumData(data.injectionTime) + forMainFrameOnly:data.isMainFrameOnly.boolValue]; } WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData( 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 647cb81cc3bd..47875428d5c5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -116,106 +116,170 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString * url; -@property(nonatomic, copy, nullable) NSString * httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; -@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString *url; +@property(nonatomic, copy, nullable) NSString *httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; +@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString * source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; -@property(nonatomic, strong) NSNumber * isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString *source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; +@property(nonatomic, strong) NSNumber *isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray * propertyKeys; -@property(nonatomic, strong) NSArray * propertyValues; + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray *propertyKeys; +@property(nonatomic, strong) NSArray *propertyValues; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId + ofTypes:(NSArray *)dataTypes + modifiedSince:(NSNumber *)secondsModifiedSinceEpoch + completion:(void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId + toValue:(nullable NSNumber *)value + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId + isOpaque:(NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId + forTypes: + (NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error; @end -extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + handlerIdentifier:(NSNumber *)handlerInstanceid + ofName:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + name:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId + userScript:(FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId + isEnabled:(NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -224,71 +288,126 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId + functionIdentifier:(nullable NSNumber *)functionInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + URL:(nullable NSString *)url + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + options: + (NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier: + (nullable NSNumber *)navigationDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId + request:(FWFNSUrlRequestData *)request + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId + HTMLString:(NSString *)string + baseURL:(nullable NSString *)baseUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId + fileURL:(NSString *)url + readAccessURL:(NSString *)readAccessUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId + assetKey:(NSString *)key + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId + javaScriptString:(NSString *)javaScriptString + completion:(void (^)(id _Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -297,16 +416,22 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId + dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId + cookie:(FWFNSHttpCookieData *)cookie + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index dfbc0702ee6a..3478903402ec 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,26 +14,25 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code": (error.code ? error.code : [NSNull null]), - @"message": (error.message ? error.message : [NSNull null]), - @"details": (error.details ? error.details : [NSNull null]), - }; + @"code" : (error.code ? error.code : [NSNull null]), + @"message" : (error.message ? error.message : [NSNull null]), + @"details" : (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result": (result ? result : [NSNull null]), - @"error": errorDict, - }; + @"result" : (result ? result : [NSNull null]), + @"error" : errorDict, + }; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -69,12 +68,14 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -85,12 +86,14 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -101,12 +104,14 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -117,7 +122,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -133,12 +138,14 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -149,10 +156,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -170,15 +177,22 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", + (self.httpMethod ? self.httpMethod : [NSNull null]), + @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), + @"httpBody", + (self.allHttpHeaderFields ? self.allHttpHeaderFields + : [NSNull null]), + @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -188,20 +202,27 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = + [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", + (self.injectionTime ? [self.injectionTime toMap] + : [NSNull null]), + @"injectionTime", + (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), + @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues { - FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = propertyKeys; pigeonResult.propertyValues = propertyValues; return pigeonResult; @@ -215,22 +236,24 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), @"propertyKeys", (self.propertyValues ? self.propertyValues : [NSNull null]), @"propertyValues", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), + @"propertyKeys", + (self.propertyValues ? self.propertyValues : [NSNull null]), + @"propertyValues", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -238,13 +261,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -265,43 +286,52 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createDefaultDataStoreWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -309,30 +339,36 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId + ofTypes:arg_dataTypes + modifiedSince:arg_secondsModifiedSinceEpoch + completion:^(NSNumber *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -362,42 +398,48 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(contentOffsetForViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId error:&error]; + NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: + toValue:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -406,19 +448,20 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -427,8 +470,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -458,63 +500,73 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier: + toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -524,30 +576,34 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO [api scrollByForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId + toX:arg_x + y:arg_y + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -555,15 +611,13 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -571,13 +625,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -598,22 +650,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -621,71 +676,87 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." + @"setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: + forTypes:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId + forTypes:arg_types + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -693,18 +764,16 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -712,17 +781,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -743,86 +809,109 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = + [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addScriptMessageHandlerForControllerWithIdentifier: + handlerIdentifier:ofName:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" + @"ofName:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + handlerIdentifier:arg_handlerInstanceid + ofName:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + name:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -830,40 +919,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: + userScript:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId + userScript:arg_userScript + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllUserScriptsForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -871,8 +966,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -902,53 +996,63 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = + [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId + isEnabled:arg_enabled + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -978,22 +1082,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = + [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1001,8 +1108,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1032,22 +1138,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1055,29 +1164,33 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId + functionIdentifier:arg_functionInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1107,15 +1220,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKNavigationDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1127,29 +1240,35 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId + webViewIdentifier:(NSNumber *)arg_webViewInstanceId + URL:(nullable NSString *)arg_url + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, + (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, + (arg_url == nil) ? [NSNull null] : arg_url + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1157,13 +1276,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1184,22 +1301,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = + [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(disposeObjectWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1207,53 +1327,67 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addObserverForObjectWithIdentifier: + observerIdentifier:keyPath:options:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = + GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + options:arg_options + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: + observerIdentifier:keyPath:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1283,15 +1417,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = + [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFFunctionFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1303,50 +1437,49 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1354,41 +1487,32 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1409,85 +1533,101 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_uiDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_navigationDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(URLForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1495,39 +1635,44 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: + error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: + request:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1536,63 +1681,75 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: + HTMLString:baseURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId + HTMLString:arg_string + baseURL:arg_baseUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); + NSCAssert([api respondsToSelector:@selector + (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId + fileURL:arg_url + readAccessURL:arg_readAccessUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: + assetKey:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1601,19 +1758,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1621,19 +1779,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1641,19 +1800,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1661,19 +1821,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1681,19 +1842,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(reloadWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1701,19 +1863,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(titleForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1721,71 +1884,85 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: + userAgent:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId + javaScriptString:arg_javaScriptString + completion:^(id _Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1815,22 +1992,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec() ]; + codec:FWFWKUIDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1838,8 +2018,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1847,18 +2026,16 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1866,17 +2043,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1897,53 +2071,62 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: + dataStoreIdentifier:error:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId + dataStoreIdentifier:arg_websiteDataStoreInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: + cookie:completion:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_instanceId + cookie:arg_cookie + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h new file mode 100644 index 000000000000..fca1e83c86e0 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. + */ +@interface FWFNavigationDelegate : NSObject +@end + +/** + * Host api implementation for WKNavigationDelegate. + * + * Handles creating WKNavigationDelegate that intercommunicate with a paired Dart object. + */ +@interface FWFNavigationDelegateHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m new file mode 100644 index 000000000000..0e4f079a584f --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -0,0 +1,33 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFNavigationDelegateHostApi.h" +#import "FWFWebViewConfigurationHostApi.h" + +@implementation FWFNavigationDelegate +@end + +@interface FWFNavigationDelegateHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFNavigationDelegateHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (FWFNavigationDelegate *)navigationDelegateForIdentifier:(NSNumber *)instanceId { + return (FWFNavigationDelegate *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + FWFNavigationDelegate *navigationDelegate = [[FWFNavigationDelegate alloc] init]; + [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m index afe4914fceda..37662b5fc9f4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFDataConverters.h" #import "FWFScriptMessageHandlerHostApi.h" - +#import "FWFDataConverters.h" @implementation FWFScriptMessageHandler -- (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message { - +- (void)userContentController:(nonnull WKUserContentController *)userContentController + didReceiveScriptMessage:(nonnull WKScriptMessage *)message { } @end @@ -25,14 +24,14 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (FWFScriptMessageHandler*)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { - return (FWFScriptMessageHandler*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (FWFScriptMessageHandler *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { + return (FWFScriptMessageHandler *)[self.instanceManager + instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] init]; - [self.instanceManager addInstance:scriptMessageHandler - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h new file mode 100644 index 000000000000..8795b00e9001 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. + */ +@interface FWFUIDelegate : NSObject +@end + +/** + * Host api implementation for WKUIDelegate. + * + * Handles creating WKUIDelegate that intercommunicate with a paired Dart object. + */ +@interface FWFUIDelegateHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m new file mode 100644 index 000000000000..2621c5dde287 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -0,0 +1,33 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFUIDelegateHostApi.h" +#import "FWFWebViewConfigurationHostApi.h" + +@implementation FWFUIDelegate +@end + +@interface FWFUIDelegateHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUIDelegateHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (FWFUIDelegate *)delegateForIdentifier:(NSNumber *)instanceId { + return (FWFUIDelegate *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] init]; + [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m index 32a3d1265ad9..2db7cff0b68e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import "FWFUserContentControllerHostApi.h" #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" -#import "FWFUserContentControllerHostApi.h" @interface FWFUserContentControllerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -19,8 +19,9 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKUserContentController*)userContentControllerForIdentifier:(NSNumber *)instanceId { - return (WKUserContentController*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (WKUserContentController *)userContentControllerForIdentifier:(NSNumber *)instanceId { + return (WKUserContentController *)[self.instanceManager + instanceForIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -28,50 +29,51 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.userContentController - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.userContentController + withIdentifier:instanceId.longValue]; } - - (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - handlerIdentifier:(nonnull NSNumber *)handler - ofName:(nonnull NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error { - + handlerIdentifier:(nonnull NSNumber *)handler + ofName:(nonnull NSString *)name + error: + (FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:instanceId] - addScriptMessageHandler:(id)[self.instanceManager instanceForIdentifier:handler.longValue] - name:name]; + addScriptMessageHandler:(id)[self.instanceManager + instanceForIdentifier:handler.longValue] + name:name]; } - (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - name:(nonnull NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandlerForName -:name]; + name:(nonnull NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error { + [[self userContentControllerForIdentifier:instanceId] removeScriptMessageHandlerForName:name]; } - (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { + error: + (FlutterError *_Nullable *_Nonnull) + error { if (@available(iOS 14.0, *)) { - [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers - ]; + [[self userContentControllerForIdentifier:instanceId] removeAllScriptMessageHandlers]; } else { - *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" - message:@"removeAllScriptMessageHandlers is only supported on versions 14+." - details:nil]; + *error = [FlutterError + errorWithCode:@"FWFUnsupportedVersionError" + message:@"removeAllScriptMessageHandlers is only supported on versions 14+." + details:nil]; } } - (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId - userScript:(nonnull FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error { - [[self userContentControllerForIdentifier:instanceId] addUserScript:FWFWKUserScriptFromScriptData(userScript)]; + userScript:(nonnull FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error { + [[self userContentControllerForIdentifier:instanceId] + addUserScript:FWFWKUserScriptFromScriptData(userScript)]; } - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { + error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:instanceId] removeAllUserScripts]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index 9f4fe592a249..bf2d518c5977 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -11,11 +11,13 @@ #import #import #import +#import #import +#import +#import +#import #import #import #import #import #import -#import -#import 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 bd766e6cb544..26214b040fa0 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 @@ -221,7 +221,9 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), + allHttpHeaderFields: + (pigeonMap['allHttpHeaderFields'] as Map?)! + .cast(), ); } } @@ -250,7 +252,8 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode( + pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -276,8 +279,10 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - propertyKeys: (pigeonMap['propertyKeys'] as List?)!.cast(), - propertyValues: (pigeonMap['propertyValues'] as List?)!.cast(), + propertyKeys: (pigeonMap['propertyKeys'] as List?)! + .cast(), + propertyValues: + (pigeonMap['propertyValues'] as List?)!.cast(), ); } } @@ -289,20 +294,19 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -311,24 +315,30 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -341,7 +351,9 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -350,7 +362,8 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -361,18 +374,26 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes( + int arg_instanceId, + List arg_dataTypes, + double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_dataTypes, + arg_secondsModifiedSinceEpoch + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -397,7 +418,8 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -405,7 +427,8 @@ class UIViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -414,7 +437,8 @@ class UIViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -432,16 +456,18 @@ class UIViewHostApi { Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -454,16 +480,18 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -483,24 +511,29 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -513,7 +546,8 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -522,7 +556,8 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -540,16 +575,19 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -560,18 +598,22 @@ class UIScrollViewHostApi { } } - Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset( + int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -590,20 +632,19 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -612,15 +653,18 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -629,7 +673,8 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -640,18 +685,23 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -662,18 +712,22 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -684,18 +738,22 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, + List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -714,27 +772,25 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -743,24 +799,31 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -771,18 +834,23 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler( + int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_handlerInstanceid, arg_name]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -793,18 +861,22 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler( + int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -817,7 +889,9 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -826,7 +900,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -837,18 +912,23 @@ class WKUserContentControllerHostApi { } } - Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript( + int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) as Map?; + await channel.send([arg_instanceId, arg_userScript]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -861,7 +941,9 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -870,7 +952,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -890,24 +973,30 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -918,18 +1007,21 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -949,15 +1041,18 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = + _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -966,7 +1061,8 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -986,15 +1082,18 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1003,7 +1102,8 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1014,18 +1114,23 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation( + int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1040,26 +1145,36 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } + abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation( + int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation( + arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1074,20 +1189,19 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1096,7 +1210,8 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1104,7 +1219,8 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1113,7 +1229,8 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1124,18 +1241,28 @@ class NSObjectHostApi { } } - Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { + Future addObserver( + int arg_instanceId, + int arg_observerInstanceId, + String arg_keyPath, + List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_observerInstanceId, + arg_keyPath, + arg_options + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1146,18 +1273,22 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, + String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send( + [arg_instanceId, arg_observerInstanceId, arg_keyPath]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1172,22 +1303,27 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } + abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1203,69 +1339,61 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1274,24 +1402,29 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create(int arg_instanceId, int arg_configurationInstanceId) async { + Future create( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1302,18 +1435,22 @@ class WKWebViewHostApi { } } - Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate( + int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1324,18 +1461,22 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate( + int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_navigationDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1348,7 +1489,8 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1357,7 +1499,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1370,7 +1513,8 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1379,7 +1523,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1395,18 +1540,21 @@ class WKWebViewHostApi { } } - Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest( + int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1417,18 +1565,22 @@ class WKWebViewHostApi { } } - Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString( + int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1439,18 +1591,22 @@ class WKWebViewHostApi { } } - Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl( + int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_url, arg_readAccessUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1463,16 +1619,18 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1485,7 +1643,8 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1494,7 +1653,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1512,7 +1672,8 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1521,7 +1682,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1539,7 +1701,8 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1548,7 +1711,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1561,7 +1725,8 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1570,7 +1735,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1583,7 +1749,8 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1592,7 +1759,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1605,7 +1773,8 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1614,7 +1783,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1625,18 +1795,22 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1647,18 +1821,22 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent( + int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) as Map?; + await channel.send([arg_instanceId, arg_userAgent]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1669,18 +1847,22 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript( + int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1700,7 +1882,8 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1708,7 +1891,8 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1717,7 +1901,8 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1736,27 +1921,25 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1765,24 +1948,30 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore( + int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_websiteDataStoreInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1793,18 +1982,21 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie( + int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h index 18449df95b77..482c791d66d4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h @@ -1,36 +1,45 @@ /** - * Converts an FWFNSKeyValueObservingOptionsEnumData to an NSKeyValueObservingOptions. + * Converts an FWFNSKeyValueObservingOptionsEnumData to an + * NSKeyValueObservingOptions. * - * @param data The data object containing information to create an NSKeyValueObservingOptions. + * @param data The data object containing information to create an + * NSKeyValueObservingOptions. * * @return An NSKeyValueObservingOptions or -1 if data could not be converted. */ -extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData* data); +extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData* data); /** * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. * - * @param data The data object containing information to create an NSKeyValueChange. + * @param data The data object containing information to create an + * NSKeyValueChange. * * @return An NSKeyValueChange or -1 if data could not be converted. */ -extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData* data); +extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData( + FWFNSKeyValueChangeEnumData* data); /** * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. * - * @param data The data object containing information to create an NSKeyValueChangeKey. + * @param data The data object containing information to create an + * NSKeyValueChangeKey. * * @return An NSKeyValueChangeKey or -1 if data could not be converted. */ -extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData* data); +extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData( + FWFNSKeyValueChangeKeyEnumData* data); /** * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. * - * @param data The data object containing information to create an NSHttpCookiePropertyKey. + * @param data The data object containing information to create an + * NSHttpCookiePropertyKey. * * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. */ -extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData* data); +extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData* data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m index ea64444b790d..4f8730819731 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m @@ -1,19 +1,18 @@ -NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyValueObservingOptionsEnumData *data) { +NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( + FWFNSKeyValueObservingOptionsEnumData *data) { switch (data.value) { - case FWFNSKeyValueObservingOptionsEnum NewValue: return NSKeyValueObservingOptions NewValue; - + case FWFNSKeyValueObservingOptionsEnum OldValue: return NSKeyValueObservingOptions OldValue; - + case FWFNSKeyValueObservingOptionsEnum InitialValue: return NSKeyValueObservingOptions InitialValue; - + case FWFNSKeyValueObservingOptionsEnum PriorNotification: return NSKeyValueObservingOptions PriorNotification; - } return -1; @@ -21,19 +20,17 @@ NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData(FWFNSKeyVal NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data) { switch (data.value) { - case FWFNSKeyValueChangeEnum Setting: return NSKeyValueChange Setting; - + case FWFNSKeyValueChangeEnum Insertion: return NSKeyValueChange Insertion; - + case FWFNSKeyValueChangeEnum Removal: return NSKeyValueChange Removal; - + case FWFNSKeyValueChangeEnum Replacement: return NSKeyValueChange Replacement; - } return -1; @@ -41,72 +38,69 @@ NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *da NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data) { switch (data.value) { - case FWFNSKeyValueChangeKeyEnum Indexes: return NSKeyValueChangeKey Indexes; - + case FWFNSKeyValueChangeKeyEnum Kind: return NSKeyValueChangeKey Kind; - + case FWFNSKeyValueChangeKeyEnum NewValue: return NSKeyValueChangeKey NewValue; - + case FWFNSKeyValueChangeKeyEnum NotificationIsPrior: return NSKeyValueChangeKey NotificationIsPrior; - + case FWFNSKeyValueChangeKeyEnum OldValue: return NSKeyValueChangeKey OldValue; - } return -1; } -NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData(FWFNSHttpCookiePropertyKeyEnumData *data) { +NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( + FWFNSHttpCookiePropertyKeyEnumData *data) { switch (data.value) { - case FWFNSHttpCookiePropertyKeyEnum Comment: return NSHttpCookiePropertyKey Comment; - + case FWFNSHttpCookiePropertyKeyEnum CommentUrl: return NSHttpCookiePropertyKey CommentUrl; - + case FWFNSHttpCookiePropertyKeyEnum Discard: return NSHttpCookiePropertyKey Discard; - + case FWFNSHttpCookiePropertyKeyEnum Domain: return NSHttpCookiePropertyKey Domain; - + case FWFNSHttpCookiePropertyKeyEnum Expires: return NSHttpCookiePropertyKey Expires; - + case FWFNSHttpCookiePropertyKeyEnum MaximumAge: return NSHttpCookiePropertyKey MaximumAge; - + case FWFNSHttpCookiePropertyKeyEnum Name: return NSHttpCookiePropertyKey Name; - + case FWFNSHttpCookiePropertyKeyEnum OriginUrl: return NSHttpCookiePropertyKey OriginUrl; - + case FWFNSHttpCookiePropertyKeyEnum Path: return NSHttpCookiePropertyKey Path; - + case FWFNSHttpCookiePropertyKeyEnum Port: return NSHttpCookiePropertyKey Port; - + case FWFNSHttpCookiePropertyKeyEnum SameSitePolicy: return NSHttpCookiePropertyKey SameSitePolicy; - + case FWFNSHttpCookiePropertyKeyEnum Secure: return NSHttpCookiePropertyKey Secure; - + case FWFNSHttpCookiePropertyKeyEnum Value: return NSHttpCookiePropertyKey Value; - + case FWFNSHttpCookiePropertyKeyEnum Version: return NSHttpCookiePropertyKey Version; - } return -1; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h index a48e318b58de..724a5b1263d0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h @@ -11,8 +11,6 @@ NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKPreferences. * @@ -36,8 +34,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKWebsiteDataStore. * @@ -61,8 +57,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKHttpCookieStore. * @@ -86,14 +80,12 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - /** * Implementation of WKScriptMessageHandler for FWFScriptMessageHandlerHostApiImpl. */ @interface FWFScriptMessageHandler : NSObject @end - /** * Host api implementation for WKScriptMessageHandler. * @@ -117,8 +109,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKUserContentController. * @@ -142,8 +132,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for WKWebViewConfiguration. * @@ -167,14 +155,12 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - /** * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. */ @interface FWFUIDelegate : NSObject @end - /** * Host api implementation for WKUIDelegate. * @@ -198,14 +184,12 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - /** * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. */ @interface FWFNavigationDelegate : NSObject @end - /** * Host api implementation for WKNavigationDelegate. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m index 23f01b08b488..395d1e073b17 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m @@ -4,10 +4,8 @@ // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFPreferencesHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFPreferencesHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -23,32 +21,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKPreferences - - *)preferencesForIdentifier:(NSNumber *)instanceId { + + WKPreferences + + *)preferencesForIdentifier:(NSNumber *)instanceId { return ( - - - WKPreferences - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + WKPreferences + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - WKPreferences - - * preferences - = - - - [[WKPreferences alloc] init]; - - [self.instanceManager addInstance:preferences - withIdentifier:instanceId.longValue]; + WKPreferences + + *preferences = + + [[WKPreferences alloc] init]; + + [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -56,24 +48,18 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.preferences - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; } - - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId - - enabled:( - nonnull NSNumber *)enabled - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self preferences ForIdentifier:instanceId] setJavaScriptEnabled + + enabled:(nonnull NSNumber *)enabled + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self preferences ForIdentifier:instanceId] setJavaScriptEnabled :enabled - - + ]; } @@ -87,8 +73,6 @@ - (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)ins #import "FWFWebViewConfigurationHostApi.h" #import "FWFWebsiteDataStoreHostApi.h" - - @interface FWFWebsiteDataStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -103,32 +87,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebsiteDataStore - - *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { + + WKWebsiteDataStore + + *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { return ( - - - WKWebsiteDataStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + WKWebsiteDataStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - WKWebsiteDataStore - - * websiteDataStore - = - - - [[WKWebsiteDataStore alloc] init]; - - [self.instanceManager addInstance:websiteDataStore - withIdentifier:instanceId.longValue]; + WKWebsiteDataStore + + *websiteDataStore = + + [[WKWebsiteDataStore alloc] init]; + + [self.instanceManager addInstance:websiteDataStore withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -136,29 +114,24 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.websiteDataStore - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.websiteDataStore + withIdentifier:instanceId.longValue]; } - - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - - dataTypes:( - nonnull NSArray *)dataTypes - - since:( - nonnull NSNumber *)since - - error:(FlutterError *_Nullable *_Nonnull)error { - return - [[self websiteDataStore ForIdentifier:instanceId] removeDataOfTypes - -:dataTypes - - - since:since - + + dataTypes: + (nonnull NSArray *)dataTypes + + since:(nonnull NSNumber *)since + + error:(FlutterError *_Nullable *_Nonnull)error { + return [[self websiteDataStore ForIdentifier:instanceId] removeDataOfTypes + + :dataTypes + + since:since + ]; } @@ -169,10 +142,8 @@ - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFHttpCookieStoreHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFHttpCookieStoreHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -188,32 +159,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKHttpCookieStore - - *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { + + WKHttpCookieStore + + *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { return ( - - - WKHttpCookieStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + WKHttpCookieStore + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - WKHttpCookieStore - - * httpCookieStore - = - - - [[WKHttpCookieStore alloc] init]; - - [self.instanceManager addInstance:httpCookieStore - withIdentifier:instanceId.longValue]; + WKHttpCookieStore + + *httpCookieStore = + + [[WKHttpCookieStore alloc] init]; + + [self.instanceManager addInstance:httpCookieStore withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -221,24 +186,19 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.httpCookieStore - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.httpCookieStore + withIdentifier:instanceId.longValue]; } - - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId - - cookie:( - nonnull NSHttpCookie *)cookie - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self httpCookieStore ForIdentifier:instanceId] setCookie + + cookie:(nonnull NSHttpCookie *)cookie + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self httpCookieStore ForIdentifier:instanceId] setCookie :cookie - - + ]; } @@ -249,14 +209,12 @@ - (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFScriptMessageHandlerHostApi.h" - +#import "FWFWebViewConfigurationHostApi.h" @implementation FWFScriptMessageHandler @end - @interface FWFScriptMessageHandlerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -270,33 +228,25 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- ( - FWFScriptMessageHandler - - - *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { +- (FWFScriptMessageHandler + + *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { return ( - + FWFScriptMessageHandler - - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - FWFScriptMessageHandler - - - * scriptMessageHandler - = - - [[FWFScriptMessageHandler alloc] init]; - - - [self.instanceManager addInstance:scriptMessageHandler - withIdentifier:instanceId.longValue]; + + *scriptMessageHandler = + + [[FWFScriptMessageHandler alloc] init]; + + [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -304,12 +254,10 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.scriptMessageHandler - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.scriptMessageHandler + withIdentifier:instanceId.longValue]; } - @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -317,10 +265,8 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFUserContentControllerHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFUserContentControllerHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -336,32 +282,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKUserContentController - - *)userContentControllerForIdentifier:(NSNumber *)instanceId { + + WKUserContentController + + *)userContentControllerForIdentifier:(NSNumber *)instanceId { return ( - - - WKUserContentController - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + WKUserContentController + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - WKUserContentController - - * userContentController - = - - - [[WKUserContentController alloc] init]; - - [self.instanceManager addInstance:userContentController - withIdentifier:instanceId.longValue]; + WKUserContentController + + *userContentController = + + [[WKUserContentController alloc] init]; + + [self.instanceManager addInstance:userContentController withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -369,79 +309,67 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.userContentController - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.userContentController + withIdentifier:instanceId.longValue]; } - - (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - handler:( - nonnull WKScriptMessageHandler *)handler - - name:( - nonnull NSString *)name - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentController ForIdentifier:instanceId] addScriptMessageHandler - -:handler - - - name:name - + + handler:(nonnull WKScriptMessageHandler *)handler + + name:(nonnull NSString *)name + + error: + (FlutterError *_Nullable *_Nonnull)error { + [[self userContentController ForIdentifier:instanceId] addScriptMessageHandler + + :handler + + name:name + ]; } - (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - name:( - nonnull NSString *)name - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentController ForIdentifier:instanceId] removeScriptMessageHandler + + name:(nonnull NSString *)name + + error:(FlutterError *_Nullable *_Nonnull) + error { + [[self userContentController ForIdentifier:instanceId] removeScriptMessageHandler :name - - + ]; } - (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentController ForIdentifier:instanceId] removeAllScriptMessageHandlers - + error: + (FlutterError *_Nullable *_Nonnull) + error { + [[self userContentController ForIdentifier:instanceId] removeAllScriptMessageHandlers + ]; } - (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - userScript:( - nonnull WKUserScript *)userScript - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentController ForIdentifier:instanceId] addUserScript + + userScript:(nonnull WKUserScript *)userScript + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self userContentController ForIdentifier:instanceId] addUserScript :userScript - - + ]; } - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self userContentController ForIdentifier:instanceId] removeAllUserScripts - + error:(FlutterError *_Nullable *_Nonnull)error { + [[self userContentController ForIdentifier:instanceId] removeAllUserScripts + ]; } @@ -453,9 +381,6 @@ - (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)inst #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - - @interface FWFWebViewConfigurationHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -471,32 +396,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - WKWebViewConfiguration - - *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { + + WKWebViewConfiguration + + *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { return ( - - - WKWebViewConfiguration - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + WKWebViewConfiguration + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - WKWebViewConfiguration - - * webViewConfiguration - = - - - [[WKWebViewConfiguration alloc] init]; - - [self.instanceManager addInstance:webViewConfiguration - withIdentifier:instanceId.longValue]; + WKWebViewConfiguration + + *webViewConfiguration = + + [[WKWebViewConfiguration alloc] init]; + + [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -504,39 +423,39 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.webViewConfiguration - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.webViewConfiguration + withIdentifier:instanceId.longValue]; } - - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - allow:( - nonnull NSNumber *)allow - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self webViewConfiguration ForIdentifier:instanceId] setAllowsInlineMediaPlayback + + allow:(nonnull NSNumber *)allow + + error: + (FlutterError *_Nullable *_Nonnull) + error { + [[self webViewConfiguration ForIdentifier:instanceId] setAllowsInlineMediaPlayback :allow - - + ]; } -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - types:( - nonnull NSArray *)types - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self webViewConfiguration ForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + + types: + (nonnull NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + + error: + (FlutterError *_Nullable *_Nonnull) + error { + [[self webViewConfiguration ForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback :types - - + ]; } @@ -547,14 +466,12 @@ - (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull N // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFUIDelegateHostApi.h" - +#import "FWFWebViewConfigurationHostApi.h" @implementation FWFUIDelegate @end - @interface FWFUIDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -568,33 +485,25 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- ( - FWFUIDelegate - - - *)uIDelegateForIdentifier:(NSNumber *)instanceId { +- (FWFUIDelegate + + *)uIDelegateForIdentifier:(NSNumber *)instanceId { return ( - + FWFUIDelegate - - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - FWFUIDelegate - - - * uIDelegate - = - - [[FWFUIDelegate alloc] init]; - - - [self.instanceManager addInstance:uIDelegate - withIdentifier:instanceId.longValue]; + + *uIDelegate = + + [[FWFUIDelegate alloc] init]; + + [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -602,12 +511,9 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.uIDelegate - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.uIDelegate withIdentifier:instanceId.longValue]; } - @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -615,14 +521,12 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFNavigationDelegateHostApi.h" - +#import "FWFWebViewConfigurationHostApi.h" @implementation FWFNavigationDelegate @end - @interface FWFNavigationDelegateHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @end @@ -636,33 +540,25 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- ( - FWFNavigationDelegate - - - *)navigationDelegateForIdentifier:(NSNumber *)instanceId { +- (FWFNavigationDelegate + + *)navigationDelegateForIdentifier:(NSNumber *)instanceId { return ( - + FWFNavigationDelegate - - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - FWFNavigationDelegate - - - * navigationDelegate - = - - [[FWFNavigationDelegate alloc] init]; - - - [self.instanceManager addInstance:navigationDelegate - withIdentifier:instanceId.longValue]; + + *navigationDelegate = + + [[FWFNavigationDelegate alloc] init]; + + [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -670,10 +566,8 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.navigationDelegate - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.navigationDelegate + withIdentifier:instanceId.longValue]; } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m index 638b8946c136..d974bff6fbe2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m @@ -20,26 +20,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - WKPreferences - *preferences = ( - - - WKPreferences - *) [instanceManager instanceForIdentifier:0]; - - + + WKPreferences *preferences = ( + + WKPreferences *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); - + XCTAssertNil(error); } - - (void)test SetJavaScriptEnabled { - - - WKPreferences + WKPreferences *mockPreferences = OCMClassMock([ @@ -51,20 +43,18 @@ - (void)test SetJavaScriptEnabled { [instanceManager addInstance:mockPreferences withIdentifier:0]; FWFPreferencesHostApiImpl *hostApi = - [[FWFPreferencesHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 - - enabled:aValue - - error:&error]; + + enabled:aValue + + error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled :aValue - - + ]); XCTAssertNil(error); } @@ -92,26 +82,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - WKWebsiteDataStore - *websiteDataStore = ( - - - WKWebsiteDataStore - *) [instanceManager instanceForIdentifier:0]; - - + + WKWebsiteDataStore *websiteDataStore = ( + + WKWebsiteDataStore *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([websiteDataStore isKindOfClass:[WKWebsiteDataStore class]]); - + XCTAssertNil(error); } - - (void)test RemoveDataOfTypes { - - - WKWebsiteDataStore + WKWebsiteDataStore *mockWebsiteDataStore = OCMClassMock([ @@ -123,24 +105,22 @@ - (void)test RemoveDataOfTypes { [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; FWFWebsiteDataStoreHostApiImpl *hostApi = - [[FWFWebsiteDataStoreHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeDataFromDataStoreWithIdentifier:@0 - - dataTypes:aValue - - since:aValue - - error:&error]; + + dataTypes:aValue + + since:aValue + + error:&error]; OCMVerify([mockWebsiteDataStore removeDataOfTypes -:aValue - - - since:aValue - + :aValue + + since:aValue + ]); XCTAssertNil(error); } @@ -168,26 +148,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - WKHttpCookieStore - *httpCookieStore = ( - - - WKHttpCookieStore - *) [instanceManager instanceForIdentifier:0]; - - + + WKHttpCookieStore *httpCookieStore = ( + + WKHttpCookieStore *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([httpCookieStore isKindOfClass:[WKHttpCookieStore class]]); - + XCTAssertNil(error); } - - (void)test SetCookie { - - - WKHttpCookieStore + WKHttpCookieStore *mockHttpCookieStore = OCMClassMock([ @@ -199,20 +171,18 @@ - (void)test SetCookie { [instanceManager addInstance:mockHttpCookieStore withIdentifier:0]; FWFHttpCookieStoreHostApiImpl *hostApi = - [[FWFHttpCookieStoreHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setCookieForStoreWithIdentifier:@0 - - cookie:aValue - - error:&error]; + + cookie:aValue + + error:&error]; OCMVerify([mockHttpCookieStore setCookie :aValue - - + ]); XCTAssertNil(error); } @@ -240,24 +210,20 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - FWFScriptMessageHandler - - - *scriptMessageHandler = ( - - FWFScriptMessageHandler - - - *) [instanceManager instanceForIdentifier:0]; - + + FWFScriptMessageHandler + + *scriptMessageHandler = ( + + FWFScriptMessageHandler + + *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([scriptMessageHandler conformsToProtocol:@protocol(WKScriptMessageHandler)]); - - + XCTAssertNil(error); } - @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -281,26 +247,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - WKUserContentController - *userContentController = ( - - - WKUserContentController - *) [instanceManager instanceForIdentifier:0]; - - + + WKUserContentController *userContentController = ( + + WKUserContentController *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); - + XCTAssertNil(error); } - - (void)test AddScriptMessageHandler { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -312,32 +270,28 @@ - (void)test AddScriptMessageHandler { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 - - handler:aValue - - name:aValue - - error:&error]; + + handler:aValue + + name:aValue + + error:&error]; OCMVerify([mockUserContentController addScriptMessageHandler -:aValue - - - name:aValue - + :aValue + + name:aValue + ]); XCTAssertNil(error); } - (void)test RemoveScriptMessageHandler { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -349,28 +303,24 @@ - (void)test RemoveScriptMessageHandler { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 - - name:aValue - - error:&error]; + + name:aValue + + error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandler :aValue - - + ]); XCTAssertNil(error); } - (void)test RemoveAllScriptMessageHandlers { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -382,24 +332,20 @@ - (void)test RemoveAllScriptMessageHandlers { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers - ]); XCTAssertNil(error); } - (void)test AddUserScript { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -411,28 +357,24 @@ - (void)test AddUserScript { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi addUserScriptForControllerWithIdentifier:@0 - - userScript:aValue - - error:&error]; + + userScript:aValue + + error:&error]; OCMVerify([mockUserContentController addUserScript :aValue - - + ]); XCTAssertNil(error); } - (void)test RemoveAllUserScripts { - - - WKUserContentController + WKUserContentController *mockUserContentController = OCMClassMock([ @@ -444,16 +386,14 @@ - (void)test RemoveAllUserScripts { [instanceManager addInstance:mockUserContentController withIdentifier:0]; FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockUserContentController removeAllUserScripts - ]); XCTAssertNil(error); } @@ -481,26 +421,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - WKWebViewConfiguration - *webViewConfiguration = ( - - - WKWebViewConfiguration - *) [instanceManager instanceForIdentifier:0]; - - + + WKWebViewConfiguration *webViewConfiguration = ( + + WKWebViewConfiguration *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([webViewConfiguration isKindOfClass:[WKWebViewConfiguration class]]); - + XCTAssertNil(error); } - - (void)test SetAllowsInlineMediaPlayback { - - - WKWebViewConfiguration + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -512,28 +444,24 @@ - (void)test SetAllowsInlineMediaPlayback { [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - - allow:aValue - - error:&error]; + + allow:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback :aValue - - + ]); XCTAssertNil(error); } - (void)test SetMediaTypesRequiringUserActionForPlayback { - - - WKWebViewConfiguration + WKWebViewConfiguration *mockWebViewConfiguration = OCMClassMock([ @@ -545,20 +473,18 @@ - (void)test SetMediaTypesRequiringUserActionForPlayback { [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 - - types:aValue - - error:&error]; + + types:aValue + + error:&error]; OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback :aValue - - + ]); XCTAssertNil(error); } @@ -586,24 +512,20 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - FWFUIDelegate - - - *uIDelegate = ( - - FWFUIDelegate - - - *) [instanceManager instanceForIdentifier:0]; - + + FWFUIDelegate + + *uIDelegate = ( + + FWFUIDelegate + + *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([uIDelegate conformsToProtocol:@protocol(WKUIDelegate)]); - - + XCTAssertNil(error); } - @end // Copyright 2013 The Flutter Authors. All rights reserved. @@ -627,22 +549,18 @@ - (void)testCreateWithIdentifier { FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - FWFNavigationDelegate - - - *navigationDelegate = ( - - FWFNavigationDelegate - - - *) [instanceManager instanceForIdentifier:0]; - + + FWFNavigationDelegate + + *navigationDelegate = ( + + FWFNavigationDelegate + + *)[instanceManager instanceForIdentifier:0]; + XCTAssertTrue([navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]); - - + XCTAssertNil(error); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m index 13e8bcddfb7e..057c9d21557f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m @@ -32,7 +32,7 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { __name__ /**/ *)/*replace :case=camel customValues_nameWithoutPrefix*/ name - /**/ForIdentifier:(NSNumber *)instanceId { + /**/ ForIdentifier:(NSNumber *)instanceId { return ( /*if customValues_isProtocol*/ FWF__customValues_nameWithoutPrefix__ diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m index 1f7cf508d88d..0544664c0606 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m @@ -16,27 +16,33 @@ @implementation FWF__customValues_nameWithoutPrefix__HostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWF__customValues_nameWithoutPrefix__HostApiImpl *hostApi = - [[FWF__customValues_nameWithoutPrefix__HostApiImpl alloc] initWithInstanceManager:instanceManager]; + [[FWF__customValues_nameWithoutPrefix__HostApiImpl alloc] + initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; /*if customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ + FWF__class_customValues_nameWithoutPrefix__ /**/ /*if! customValues_isProtocol*/ - __name__ /**/ - */*replace :case=camel customValues_nameWithoutPrefix*/name/**/ = ( - /*if customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ /**/ - *) [instanceManager instanceForIdentifier:0]; + __name__ /**/ + * /*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ + = ( + /*if customValues_isProtocol*/ + FWF__class_customValues_nameWithoutPrefix__ + /**/ + /*if! customValues_isProtocol*/ + __name__ /**/ + *)[instanceManager instanceForIdentifier:0]; /*if customValues_isProtocol*/ - XCTAssertTrue([/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ conformsToProtocol:@protocol(__name__)]); + XCTAssertTrue( + [/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ conformsToProtocol: + @protocol(__name__)]); /**/ /*if! customValues_isProtocol*/ - XCTAssertTrue([/*replace :case=camel customValues_nameWithoutPrefix*/name/**/ isKindOfClass:[__name__ class]]); + XCTAssertTrue( + [/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ isKindOfClass:[__name__ + class]]); /**/ XCTAssertNil(error); } From 650e731c3b8e37d39595121a4a13b79e486f524a Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 16:53:27 -0700 Subject: [PATCH 10/23] converter tests --- .../ios/RunnerTests/FWFDataConvertersTests.m | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 55952373998d..57d90f6c6814 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 @@ -10,7 +10,7 @@ @interface FWFDataConvertersTests : XCTestCase @end @implementation FWFDataConvertersTests -- (void)testFNSURLRequestFromRequestData { +- (void)testFWFNSURLRequestFromRequestData { NSURLRequest *request = FWFNSURLRequestFromRequestData([FWFNSUrlRequestData makeWithUrl:@"https://flutter.dev" httpMethod:@"post" @@ -22,4 +22,25 @@ - (void)testFNSURLRequestFromRequestData { XCTAssertEqualObjects(request.HTTPBody, [NSData data]); XCTAssertEqualObjects(request.allHTTPHeaderFields, @{@"a" : @"header"}); } + +- (void)testFWFNSHTTPCookieFromCookieData { + NSHTTPCookie *cookie = FWFNSHTTPCookieFromCookieData([FWFNSHttpCookieData + makeWithPropertyKeys:@[ [FWFNSHttpCookiePropertyKeyEnumData + makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] ] + propertyValues:@[ @"cookieName" ]]); + XCTAssertEqualObjects(cookie, + [NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"cookieName"}]); +} + +- (void)testFWFWKUserScriptFromScriptData { + WKUserScript *userScript = FWFWKUserScriptFromScriptData([FWFWKUserScriptData + makeWithSource:@"mySource" + injectionTime:[FWFWKUserScriptInjectionTimeEnumData + makeWithValue:FWFWKUserScriptInjectionTimeEnumAtDocumentStart] + isMainFrameOnly:@NO]); + + XCTAssertEqualObjects(userScript.source, @"mySource"); + XCTAssertEqual(userScript.injectionTime, WKUserScriptInjectionTimeAtDocumentStart); + XCTAssertEqual(userScript.isForMainFrameOnly, NO); +} @end From c0e71666cf000b3c02172f92f3be3539461e1398 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 May 2022 19:00:47 -0700 Subject: [PATCH 11/23] uiview and scrollview --- .../ios/Runner.xcodeproj/project.pbxproj | 8 + .../RunnerTests/FWFScrollViewHostApiTests.m | 74 + .../ios/RunnerTests/FWFUIViewHostApiTests.m | 55 + .../webview_flutter_wkwebview/go.sh | 16 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 273 +--- .../ios/Classes/FWFGeneratedWebKitApis.m | 1321 +++++++---------- .../ios/Classes/FWFScrollViewHostApi.h | 22 + .../ios/Classes/FWFScrollViewHostApi.m | 59 + .../ios/Classes/FWFUIViewHostApi.h | 21 + .../ios/Classes/FWFUIViewHostApi.m | 45 + .../ios/Classes/webview-umbrella.h | 2 + .../lib/src/common/web_kit.pigeon.dart | 777 ++++------ .../lib/src/foundation/foundation.dart | 6 +- .../src/foundation/foundation.simple_ast.json | 222 +-- .../lib/src/ui_kit/output.h | 50 + .../lib/src/ui_kit/output.m | 199 +++ .../lib/src/ui_kit/output_test.m | 247 +++ .../lib/src/ui_kit/ui_kit.dart | 37 +- .../lib/src/ui_kit/ui_kit.simple_ast.json | 53 +- .../lib/src/web_kit/web_kit.simple_ast.json | 2 +- .../pigeons/web_kit.dart | 5 +- .../test/src/common/test_web_kit.pigeon.dart | 841 ++++------- .../test/src/ui_kit/ui_kit_test.mocks.dart | 6 +- .../test/src/web_kit/web_kit_test.mocks.dart | 2 +- .../web_kit_cookie_manager_test.mocks.dart | 2 +- .../web_kit_webview_widget_test.mocks.dart | 2 +- 26 files changed, 2079 insertions(+), 2268 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 53edc88a4097..1baad0d57063 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 8FB79B7928209D1300C101D3 /* FWFUserContentControllerHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */; }; 8FB79B832820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */; }; 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */; }; + 8FB79B8F2820BAB300C101D3 /* FWFScrollViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */; }; + 8FB79B912820BAC700C101D3 /* FWFUIViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -89,6 +91,8 @@ 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUserContentControllerHostApiTests.m; sourceTree = ""; }; 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFNavigationDelegateHostApiTests.m; sourceTree = ""; }; 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUIDelegateHostApiTests.m; sourceTree = ""; }; + 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFScrollViewHostApiTests.m; sourceTree = ""; }; + 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUIViewHostApiTests.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -159,6 +163,8 @@ 8FB79B7828209D1300C101D3 /* FWFUserContentControllerHostApiTests.m */, 8FB79B822820A39300C101D3 /* FWFNavigationDelegateHostApiTests.m */, 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */, + 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */, + 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -464,6 +470,8 @@ 334734012669319100DCC49E /* FLTWebViewTests.m in Sources */, 8FB79B7928209D1300C101D3 /* FWFUserContentControllerHostApiTests.m in Sources */, 8FB79B6B28204EE500C101D3 /* FWFWebsiteDataStoreHostApiTests.m in Sources */, + 8FB79B8F2820BAB300C101D3 /* FWFScrollViewHostApiTests.m in Sources */, + 8FB79B912820BAC700C101D3 /* FWFUIViewHostApiTests.m in Sources */, 334734022669319400DCC49E /* FLTWKNavigationDelegateTests.m in Sources */, 8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */, 8FB79B6D2820533B00C101D3 /* FWFWebViewConfigurationHostApiTests.m in Sources */, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m new file mode 100644 index 000000000000..bcf96c291b6d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFScrollViewHostApiTests : XCTestCase +@end + +@implementation FWFScrollViewHostApiTests +- (void)testGetContentOffset { + UIScrollView *mockScrollView = OCMClassMock([UIScrollView class]); + OCMStub([mockScrollView contentOffset]).andReturn(CGPointMake(1.0, 2.0)); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockScrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + NSArray *expectedValue = @[@1.0, @2.0]; + XCTAssertEqualObjects( + [hostApi contentOffsetForScrollViewWithIdentifier:@0 + error:&error], + expectedValue); + XCTAssertNil(error); +} + +- (void)testScrollBy { + UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)]; + scrollView.contentOffset = CGPointMake(1, 2); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:scrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi scrollByForScrollViewWithIdentifier:@0 + x:@1 + y:@2 + error:&error]; + XCTAssertEqual(scrollView.contentOffset.x, 2); + XCTAssertEqual(scrollView.contentOffset.y, 4); + XCTAssertNil(error); +} + +- (void)testSetContentOffset { + UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)]; + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:scrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setContentOffsetForScrollViewWithIdentifier:@0 + toX:@1 + y:@2 + error:&error]; + XCTAssertEqual(scrollView.contentOffset.x, 1); + XCTAssertEqual(scrollView.contentOffset.y, 2); + XCTAssertNil(error); +} +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m new file mode 100644 index 000000000000..e037591bea6d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m @@ -0,0 +1,55 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUIViewHostApiTests : XCTestCase +@end + +@implementation FWFUIViewHostApiTests +- (void)testSetBackgroundColor { + UIView *mockUIView = OCMClassMock([UIView class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUIView withIdentifier:0]; + + FWFUIViewHostApiImpl *hostApi = + [[FWFUIViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setBackgroundColorForViewWithIdentifier:@0 + toValue:@123 + error:&error]; + + OCMVerify([mockUIView setBackgroundColor:[UIColor colorWithRed:(123 >> 16 & 0xff) / 255.0 + green:(123 >> 8 & 0xff) / 255.0 + blue:(123 & 0xff) / 255.0 + alpha:(123 >> 24 & 0xff) / 255.0]]); + XCTAssertNil(error); +} + +- (void)testSetOpaque { + UIView *mockUIView = OCMClassMock([UIView class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUIView withIdentifier:0]; + + FWFUIViewHostApiImpl *hostApi = + [[FWFUIViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setOpaqueForViewWithIdentifier:@0 + isOpaque:@YES + error:&error]; + OCMVerify([mockUIView setOpaque:YES]); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/go.sh b/packages/webview_flutter/webview_flutter_wkwebview/go.sh index 402f61bdc788..02132c18f9f2 100755 --- a/packages/webview_flutter/webview_flutter_wkwebview/go.sh +++ b/packages/webview_flutter/webview_flutter_wkwebview/go.sh @@ -1,6 +1,10 @@ -flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/web_kit/web_kit.simple_ast.json --token-opener /*- lib/src/web_kit/output.h -flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m -flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h -flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/web_kit/web_kit.simple_ast.json --token-opener /*- lib/src/web_kit/output.h +#flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h +#flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/ui_kit/ui_kit.simple_ast.json --token-opener /*- lib/src/ui_kit/output.h +flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output_test.m + 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 47875428d5c5..8fe2a9b5a1ac 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -116,170 +116,104 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString *url; -@property(nonatomic, copy, nullable) NSString *httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString * url; +@property(nonatomic, copy, nullable) NSString * httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; +@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString *source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString * source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; +@property(nonatomic, strong) NSNumber * isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray *propertyKeys; -@property(nonatomic, strong) NSArray *propertyValues; + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray * propertyKeys; +@property(nonatomic, strong) NSArray * propertyValues; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId - ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)secondsModifiedSinceEpoch - completion:(void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi -/// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId - toValue:(nullable NSNumber *)value - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId - isOpaque:(NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId - isAllowed:(NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId - forTypes: - (NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - error: - (FlutterError *_Nullable *_Nonnull) - error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - handlerIdentifier:(NSNumber *)handlerInstanceid - ofName:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId - name:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId - userScript:(FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId - isEnabled:(NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -288,126 +222,71 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId - functionIdentifier:(nullable NSNumber *)functionInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId - webViewIdentifier:(NSNumber *)webViewInstanceId - URL:(nullable NSString *)url - completion:(void (^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - options: - (NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId - observerIdentifier:(NSNumber *)observerInstanceId - keyPath:(NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId - completion:(void (^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId - configurationIdentifier:(NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId - delegateIdentifier: - (nullable NSNumber *)navigationDelegateInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId - request:(FWFNSUrlRequestData *)request - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId - HTMLString:(NSString *)string - baseURL:(nullable NSString *)baseUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId - fileURL:(NSString *)url - readAccessURL:(NSString *)readAccessUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId - assetKey:(NSString *)key - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error: - (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId - isAllowed:(NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId - javaScriptString:(NSString *)javaScriptString - completion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -416,22 +295,16 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId - dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId - cookie:(FWFNSHttpCookieData *)cookie - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 3478903402ec..2f72fb2f3889 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,25 +14,26 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; + @"code": (error.code ? error.code : [NSNull null]), + @"message": (error.message ? error.message : [NSNull null]), + @"details": (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; + @"result": (result ? result : [NSNull null]), + @"error": errorDict, + }; } -static id GetNullableObject(NSDictionary *dict, id key) { +static id GetNullableObject(NSDictionary* dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } + @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -68,14 +69,12 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = - [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -86,14 +85,12 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = - [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -104,14 +101,12 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = - [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -122,7 +117,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -138,14 +133,12 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = - [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -156,10 +149,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -177,22 +170,15 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", - (self.httpMethod ? self.httpMethod : [NSNull null]), - @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), - @"httpBody", - (self.allHttpHeaderFields ? self.allHttpHeaderFields - : [NSNull null]), - @"allHttpHeaderFields", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -202,27 +188,20 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = - [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", - (self.injectionTime ? [self.injectionTime toMap] - : [NSNull null]), - @"injectionTime", - (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), - @"isMainFrameOnly", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues { - FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = propertyKeys; pigeonResult.propertyValues = propertyValues; return pigeonResult; @@ -236,24 +215,22 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), - @"propertyKeys", - (self.propertyValues ? self.propertyValues : [NSNull null]), - @"propertyValues", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), @"propertyKeys", (self.propertyValues ? self.propertyValues : [NSNull null]), @"propertyValues", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -261,11 +238,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -286,52 +265,43 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDefaultDataStoreWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -339,36 +309,30 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId - ofTypes:arg_dataTypes - modifiedSince:arg_secondsModifiedSinceEpoch - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -398,48 +362,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *api) { - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.getContentOffset" - binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForViewWithIdentifier:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForViewWithIdentifier:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api contentOffsetForViewWithIdentifier:arg_instanceId - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } + +void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: - toValue:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -448,20 +386,19 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -470,7 +407,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -500,110 +438,96 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = - [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId - error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier: - toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(scrollByForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api scrollByForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; + [api scrollByForScrollViewWithIdentifier:arg_instanceId x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId - toX:arg_x - y:arg_y - error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -611,13 +535,15 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -625,11 +551,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -650,25 +578,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -676,87 +601,71 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId - webViewIdentifier:arg_webViewInstanceId - error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId - isAllowed:arg_allow - error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." - @"setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: - forTypes:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId - forTypes:arg_types - error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -764,16 +673,18 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -781,14 +692,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -809,109 +723,86 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = - [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addScriptMessageHandlerForControllerWithIdentifier: - handlerIdentifier:ofName:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" - @"ofName:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - handlerIdentifier:arg_handlerInstanceid - ofName:arg_name - error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId - name:arg_name - error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -919,46 +810,40 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: - userScript:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId - userScript:arg_userScript - error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllUserScriptsForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -966,7 +851,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -996,63 +882,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = - [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId - isEnabled:arg_enabled - error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1082,25 +958,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1108,7 +981,8 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1138,25 +1012,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1164,33 +1035,29 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec()]; + codec:FWFWKNavigationDelegateHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], - @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " - @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId - functionIdentifier:arg_functionInstanceId - error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1220,15 +1087,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFWKNavigationDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1240,35 +1107,29 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId - webViewIdentifier:(NSNumber *)arg_webViewInstanceId - URL:(nullable NSString *)arg_url - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, - (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, - (arg_url == nil) ? [NSNull null] : arg_url - ] - reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1276,11 +1137,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1301,25 +1164,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = - [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(disposeObjectWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1327,67 +1187,53 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addObserverForObjectWithIdentifier: - observerIdentifier:keyPath:options:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = - GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - options:arg_options - error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: - observerIdentifier:keyPath:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId - observerIdentifier:arg_observerInstanceId - keyPath:arg_keyPath - error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1417,15 +1263,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = - [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFFunctionFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1437,49 +1283,50 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1487,32 +1334,41 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1533,101 +1389,85 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = - [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier: - configurationIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:configurationIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId - configurationIdentifier:arg_configurationInstanceId - error:&error]; + [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_uiDelegateInstanceId - error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId - delegateIdentifier:arg_navigationDelegateInstanceId - error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(URLForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1635,44 +1475,39 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: - error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId - error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: - request:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1681,75 +1516,63 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: - HTMLString:baseURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId - HTMLString:arg_string - baseURL:arg_baseUrl - error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId - fileURL:arg_url - readAccessURL:arg_readAccessUrl - error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: - assetKey:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1758,20 +1581,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1779,20 +1601,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1800,20 +1621,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1821,20 +1641,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1842,20 +1661,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(reloadWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1863,20 +1681,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(titleForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1884,85 +1701,71 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId - isAllowed:arg_allow - error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId - userAgent:arg_userAgent - error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId - javaScriptString:arg_javaScriptString - completion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1992,25 +1795,22 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec()]; + codec:FWFWKUIDelegateHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], - @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " - @"@selector(createWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -2018,7 +1818,8 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2026,16 +1827,18 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2043,14 +1846,17 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2071,62 +1877,53 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = - [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *api) { + +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: - dataStoreIdentifier:error:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId - dataStoreIdentifier:arg_websiteDataStoreInstanceId - error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: - cookie:completion:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_instanceId - cookie:arg_cookie - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.h new file mode 100644 index 000000000000..25f373f374e3 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for UIScrollView. + * + * Handles creating UIScrollView that intercommunicate with a paired Dart object. + */ +@interface FWFScrollViewHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m new file mode 100644 index 000000000000..ea2e4d352f79 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -0,0 +1,59 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFWebViewHostApi.h" +#import "FWFScrollViewHostApi.h" + +@interface FWFScrollViewHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScrollViewHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (UIScrollView*)scrollViewForIdentifier:(NSNumber *)instanceId { + return (UIScrollView*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + + +- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId + webViewIdentifier:(nonnull NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { + WKWebView *webView = + (WKWebView *)[self.instanceManager instanceForIdentifier:webViewInstanceId.longValue]; + [self.instanceManager addInstance:webView.scrollView withIdentifier:instanceId.longValue]; +} + + +- (NSArray *)contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { + CGPoint point = [[self scrollViewForIdentifier:instanceId] contentOffset]; + return @[@(point.x), @(point.y)]; +} + +- (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + x:(nonnull NSNumber *)x + y:(nonnull NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error { + UIScrollView *scrollView = [self scrollViewForIdentifier:instanceId]; + CGPoint contentOffset = scrollView.contentOffset; +[scrollView + setContentOffset:CGPointMake(contentOffset.x + x.doubleValue, contentOffset.y + y.doubleValue)]; +} + +- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId toX:(nonnull NSNumber *)x + y:(nonnull NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error { + +[[self scrollViewForIdentifier:instanceId] setContentOffset +:CGPointMake(x.doubleValue, y.doubleValue) + ]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.h new file mode 100644 index 000000000000..82edd6b742ca --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.h @@ -0,0 +1,21 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for UIView. + * + * Handles creating UIView that intercommunicate with a paired Dart object. + */ +@interface FWFUIViewHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m new file mode 100644 index 000000000000..69586bf869db --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -0,0 +1,45 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFUIViewHostApi.h" + +@interface FWFUIViewHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUIViewHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (UIView *)viewForIdentifier:(NSNumber *)instanceId { + return (UIView*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + + +- (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)instanceId + toValue:(nullable NSNumber *)color + error:(FlutterError *_Nullable *_Nonnull)error { + if (!color) { + [[self viewForIdentifier:instanceId] setBackgroundColor:nil]; + } + int colorInt = color.intValue; + UIColor *colorObject = [UIColor colorWithRed:(colorInt >> 16 & 0xff) / 255.0 + green:(colorInt >> 8 & 0xff) / 255.0 + blue:(colorInt & 0xff) / 255.0 + alpha:(colorInt >> 24 & 0xff) / 255.0]; + [[self viewForIdentifier:instanceId] setBackgroundColor:colorObject]; +} + +- (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId + isOpaque:(nonnull NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error { + [[self viewForIdentifier:instanceId] setOpaque:opaque.boolValue]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index bf2d518c5977..5cc822889535 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -21,3 +21,5 @@ #import #import #import +#import +#import 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 26214b040fa0..2bad9b9ceffe 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 @@ -221,9 +221,7 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: - (pigeonMap['allHttpHeaderFields'] as Map?)! - .cast(), + allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), ); } } @@ -252,8 +250,7 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode( - pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -279,10 +276,8 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - propertyKeys: (pigeonMap['propertyKeys'] as List?)! - .cast(), - propertyValues: - (pigeonMap['propertyValues'] as List?)!.cast(), + propertyKeys: (pigeonMap['propertyKeys'] as List?)!.cast(), + propertyValues: (pigeonMap['propertyValues'] as List?)!.cast(), ); } } @@ -294,19 +289,20 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -315,30 +311,24 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -351,9 +341,7 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -362,8 +350,7 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -374,26 +361,18 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes( - int arg_instanceId, - List arg_dataTypes, - double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_dataTypes, - arg_secondsModifiedSinceEpoch - ]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -418,56 +397,24 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIViewHostApiCodec(); - Future> getContentOffset(int arg_instanceId) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId]) as Map?; - if (replyMap == 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?)!; - throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], - ); - } else if (replyMap['result'] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyMap['result'] as List?)!.cast(); - } - } - Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -480,18 +427,16 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -511,29 +456,24 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -546,8 +486,7 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -556,8 +495,7 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -575,19 +513,16 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -598,22 +533,18 @@ class UIScrollViewHostApi { } } - Future setContentOffset( - int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) - as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -632,19 +563,20 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -653,18 +585,15 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -673,8 +602,7 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -685,23 +613,18 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView( - int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -712,22 +635,18 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback( - int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -738,22 +657,18 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, - List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -772,25 +687,27 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -799,31 +716,24 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -834,23 +744,18 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler( - int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_handlerInstanceid, arg_name]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -861,22 +766,18 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler( - int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -889,9 +790,7 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -900,8 +799,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -912,23 +810,18 @@ class WKUserContentControllerHostApi { } } - Future addUserScript( - int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) - as Map?; + await channel.send([arg_instanceId, arg_userScript]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -941,9 +834,7 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -952,8 +843,7 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -973,30 +863,24 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration( - int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1007,21 +891,18 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled( - int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1041,18 +922,15 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1061,8 +939,7 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1082,18 +959,15 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = - _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1102,8 +976,7 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1114,23 +987,18 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation( - int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1145,36 +1013,26 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } - abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = - _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation( - int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1189,19 +1047,20 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1210,8 +1069,7 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1219,8 +1077,7 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1229,8 +1086,7 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1241,28 +1097,18 @@ class NSObjectHostApi { } } - Future addObserver( - int arg_instanceId, - int arg_observerInstanceId, - String arg_keyPath, - List arg_options) async { + Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_instanceId, - arg_observerInstanceId, - arg_keyPath, - arg_options - ]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1273,22 +1119,18 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, - String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( - [arg_instanceId, arg_observerInstanceId, arg_keyPath]) - as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1303,27 +1145,22 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } - abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1339,61 +1176,69 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1402,29 +1247,24 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create( - int arg_instanceId, int arg_configurationInstanceId) async { + Future create(int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_configurationInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1435,22 +1275,18 @@ class WKWebViewHostApi { } } - Future setUIDelegate( - int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) - as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1461,22 +1297,18 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate( - int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_navigationDelegateInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1489,8 +1321,7 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1499,8 +1330,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1513,8 +1343,7 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1523,8 +1352,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1540,21 +1368,18 @@ class WKWebViewHostApi { } } - Future loadRequest( - int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1565,22 +1390,18 @@ class WKWebViewHostApi { } } - Future loadHtmlString( - int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) - as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1591,22 +1412,18 @@ class WKWebViewHostApi { } } - Future loadFileUrl( - int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_url, arg_readAccessUrl]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1619,18 +1436,16 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1643,8 +1458,7 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1653,8 +1467,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1672,8 +1485,7 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1682,8 +1494,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1701,8 +1512,7 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1711,8 +1521,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1725,8 +1534,7 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1735,8 +1543,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1749,8 +1556,7 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1759,8 +1565,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1773,8 +1578,7 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1783,8 +1587,7 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1795,22 +1598,18 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures( - int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1821,22 +1620,18 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent( - int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) - as Map?; + await channel.send([arg_instanceId, arg_userAgent]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1847,22 +1642,18 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript( - int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) - as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1882,8 +1673,7 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1891,8 +1681,7 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1901,8 +1690,7 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1921,25 +1709,27 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1948,30 +1738,24 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore( - int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_websiteDataStoreInstanceId]) - as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1982,21 +1766,18 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie( - int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index 6112a729e7dd..243a29dd70f3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -202,7 +202,6 @@ class NSUrlRequest { /// /// Wraps [NSError](https://developer.apple.com/documentation/foundation/nserror?language=objc). @immutable -@SimpleClassAnnotation(customValues: {'isDataClass': true}) class NSError { /// Constructs an [NSError]. const NSError({ @@ -227,7 +226,6 @@ class NSError { /// /// Wraps [NSHTTPCookie](https://developer.apple.com/documentation/foundation/nshttpcookie). @immutable -@SimpleClassAnnotation(customValues: {'isDataClass': true}) class NSHttpCookie { /// Initializes an HTTP cookie object using the provided properties. const NSHttpCookie.withProperties(this.properties); @@ -237,7 +235,9 @@ class NSHttpCookie { } /// The root class of most Objective-C class hierarchies. -@SimpleClassAnnotation() +@SimpleClassAnnotation(customValues: { + 'nameWithoutPrefix': 'Object', +}) class NSObject { /// Constructs an [NSObject]. NSObject({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json index bac99f02486a..6c15d038b8b6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json @@ -1,223 +1,5 @@ { "classes": [ - { - "name": "NSError", - "methods": [], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "code", - "type": { - "name": "int", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "domain", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "localizedDescription", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [ - { - "name": "code", - "type": { - "name": "int", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "domain", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "localizedDescription", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ], - "customValues": { - "isDataClass": true - } - }, - { - "name": "NSHttpCookie", - "methods": [], - "constructors": [ - { - "name": "withProperties", - "parameters": [ - { - "name": "properties", - "type": { - "name": "Map", - "nullable": false, - "typeArguments": [ - { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - { - "name": "Object", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [ - { - "name": "properties", - "type": { - "name": "Map", - "nullable": false, - "typeArguments": [ - { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - { - "name": "Object", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ], - "customValues": { - "isDataClass": true - } - }, { "name": "NSObject", "methods": [ @@ -467,7 +249,9 @@ } ], "fields": [], - "customValues": {} + "customValues": { + "nameWithoutPrefix": "Object" + } } ], "functions": [], diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h new file mode 100644 index 000000000000..78977a890ef9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h @@ -0,0 +1,50 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for UIScrollView. + * + * Handles creating UIScrollView that intercommunicate with a paired Dart object. + */ +@interface FWFScrollViewHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for UIView. + * + * Handles creating UIView that intercommunicate with a paired Dart object. + */ +@interface FWFUIViewHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m new file mode 100644 index 000000000000..bb34fb3db17a --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m @@ -0,0 +1,199 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFScrollViewHostApi.h" + + + +@interface FWFScrollViewHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFScrollViewHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + UIScrollView + + *)scrollView ForIdentifier:(NSNumber *)instanceId { + return ( + + + UIScrollView + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + UIScrollView + + * scrollView + = + + + [[UIScrollView alloc] init]; + + [self.instanceManager addInstance:scrollView + withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager + addInstance:configuration.scrollView + withIdentifier:instanceId.longValue]; +} + + +- (void)contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull)error { + return + [[self scrollView ForIdentifier:instanceId] getContentOffset + + + ]; +} + +- (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + + offset:( + nonnull NSNumber *)offset + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self scrollView ForIdentifier:instanceId] scrollBy + +:offset + + + ]; +} + +- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + + offset:( + nonnull NSNumber *)offset + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self scrollView ForIdentifier:instanceId] setContentOffset + +:offset + + + ]; +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFUIViewHostApi.h" + + + +@interface FWFUIViewHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFUIViewHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + UIView + + *)uIView ForIdentifier:(NSNumber *)instanceId { + return ( + + + UIView + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + UIView + + * uIView + = + + + [[UIView alloc] init]; + + [self.instanceManager addInstance:uIView + withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager + addInstance:configuration.uIView + withIdentifier:instanceId.longValue]; +} + + +- (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)instanceId + + color:( nullable NSNumber *)color + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self uIView ForIdentifier:instanceId] setBackgroundColor + +:color + + + ]; +} + +- (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId + + opaque:( + nonnull NSNumber *)opaque + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self uIView ForIdentifier:instanceId] setOpaque + +:opaque + + + ]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m new file mode 100644 index 000000000000..dba7cfcae0b5 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m @@ -0,0 +1,247 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFScrollViewHostApiTests : XCTestCase +@end + +@implementation FWFScrollViewHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + UIScrollView + * scrollView + = ( + + + UIScrollView + *)[instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue( + [scrollView isKindOfClass:[UIScrollView + class]]); + + XCTAssertNil(error); +} + + +- (void)test GetContentOffset { + + + UIScrollView + *mockScrollView = OCMClassMock([ + + + UIScrollView + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockScrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi contentOffsetForScrollViewWithIdentifier:@0 + + error:&error]; + OCMVerify([mockScrollView getContentOffset + + + ]); + XCTAssertNil(error); +} + +- (void)test ScrollBy { + + + UIScrollView + *mockScrollView = OCMClassMock([ + + + UIScrollView + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockScrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi scrollByForScrollViewWithIdentifier:@0 + + offset:aValue + + error:&error]; + OCMVerify([mockScrollView scrollBy + +:aValue + + + ]); + XCTAssertNil(error); +} + +- (void)test SetContentOffset { + + + UIScrollView + *mockScrollView = OCMClassMock([ + + + UIScrollView + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockScrollView withIdentifier:0]; + + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setContentOffsetForScrollViewWithIdentifier:@0 + + offset:aValue + + error:&error]; + OCMVerify([mockScrollView setContentOffset + +:aValue + + + ]); + XCTAssertNil(error); +} + +@end + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFUIViewHostApiTests : XCTestCase +@end + +@implementation FWFUIViewHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFUIViewHostApiImpl *hostApi = + [[FWFUIViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + UIView + * uIView + = ( + + + UIView + *)[instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue( + [uIView isKindOfClass:[UIView + class]]); + + XCTAssertNil(error); +} + + +- (void)test SetBackgroundColor { + + + UIView + *mockUIView = OCMClassMock([ + + + UIView + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUIView withIdentifier:0]; + + FWFUIViewHostApiImpl *hostApi = + [[FWFUIViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setBackgroundColorForViewWithIdentifier:@0 + + color:aValue + + error:&error]; + OCMVerify([mockUIView setBackgroundColor + +:aValue + + + ]); + XCTAssertNil(error); +} + +- (void)test SetOpaque { + + + UIView + *mockUIView = OCMClassMock([ + + + UIView + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockUIView withIdentifier:0]; + + FWFUIViewHostApiImpl *hostApi = + [[FWFUIViewHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi setOpaqueForViewWithIdentifier:@0 + + opaque:aValue + + error:&error]; + OCMVerify([mockUIView setOpaque + +:aValue + + + ]); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart index 6691d3b586cf..4af57c17d00d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart @@ -16,7 +16,9 @@ import 'ui_kit_api_impls.dart'; /// A view that allows the scrolling and zooming of its contained views. /// /// Wraps [UIScrollView](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc). -@SimpleClassAnnotation() +@SimpleClassAnnotation( + customValues: {'nameWithoutPrefix': 'ScrollView'}, +) class UIScrollView extends UIView { /// Constructs a [UIScrollView] that is owned by [webView]. UIScrollView.fromWebView( @@ -35,6 +37,11 @@ class UIScrollView extends UIView { /// Point at which the origin of the content view is offset from the origin of the scroll view. /// /// Represents [WKWebView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset?language=objc). + @nsNumber + @SimpleMethodAnnotation(customValues: { + 'objcName': 'contentOffsetForScrollViewWithIdentifier', + 'returnsVoid': false, + }) Future> getContentOffset() { return _scrollViewApi.getContentOffsetForInstances(this); } @@ -43,7 +50,11 @@ class UIScrollView extends UIView { /// /// This method is not a part of UIKit and is only a helper method to make /// scrollBy atomic. - Future scrollBy(Point offset) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'scrollByForScrollViewWithIdentifier', + 'returnsVoid': true, + }) + Future scrollBy(@nsNumber Point offset) { return _scrollViewApi.scrollByForInstances(this, offset); } @@ -52,7 +63,11 @@ class UIScrollView extends UIView { /// The default value is `Point(0.0, 0.0)`. /// /// Sets [WKWebView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset?language=objc). - Future setContentOffset(Point offset) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setContentOffsetForScrollViewWithIdentifier', + 'returnsVoid': true, + }) + Future setContentOffset(@nsNumber Point offset) { return _scrollViewApi.setContentOffsetForInstances(this, offset); } } @@ -60,7 +75,9 @@ class UIScrollView extends UIView { /// Manages the content for a rectangular area on the screen. /// /// Wraps [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc). -@SimpleClassAnnotation() +@SimpleClassAnnotation( + customValues: {'nameWithoutPrefix': 'UIView'}, +) class UIView extends NSObject { /// Constructs an [NSObject]. UIView({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) @@ -76,14 +93,22 @@ class UIView extends NSObject { /// The default value is null, which results in a transparent background color. /// /// Sets [UIView.backgroundColor](https://developer.apple.com/documentation/uikit/uiview/1622591-backgroundcolor?language=objc). - Future setBackgroundColor(Color? color) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setBackgroundColorForViewWithIdentifier', + 'returnsVoid': true, + }) + Future setBackgroundColor(@nsNumber Color? color) { return _viewApi.setBackgroundColorForInstances(this, color); } /// Determines whether the view is opaque. /// /// Sets [UIView.opaque](https://developer.apple.com/documentation/uikit/uiview?language=objc). - Future setOpaque(bool opaque) { + @SimpleMethodAnnotation(customValues: { + 'objcName': 'setOpaqueForViewWithIdentifier', + 'returnsVoid': true, + }) + Future setOpaque(@nsNumber bool opaque) { return _viewApi.setOpaqueForInstances(this, opaque); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json index 587261dbe9ee..e1cbf5d187d5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json @@ -44,12 +44,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSNumber" + } }, "returnsVoid": false, "static": false, "parameters": [], - "customValues": {} + "customValues": { + "objcName": "contentOffsetForScrollViewWithIdentifier", + "returnsVoid": false + } }, { "name": "scrollBy", @@ -110,12 +115,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSNumber" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "objcName": "scrollByForScrollViewWithIdentifier", + "returnsVoid": true + } }, { "name": "setContentOffset", @@ -176,12 +186,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSNumber" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "objcName": "setContentOffsetForScrollViewWithIdentifier", + "returnsVoid": true + } } ], "constructors": [ @@ -243,7 +258,9 @@ } ], "fields": [], - "customValues": {} + "customValues": { + "nameWithoutPrefix": "ScrollView" + } }, { "name": "UIView", @@ -293,12 +310,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSNumber" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "objcName": "setBackgroundColorForViewWithIdentifier", + "returnsVoid": true + } }, { "name": "setOpaque", @@ -345,12 +367,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSNumber" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "objcName": "setOpaqueForViewWithIdentifier", + "returnsVoid": true + } } ], "constructors": [ @@ -395,7 +422,9 @@ } ], "fields": [], - "customValues": {} + "customValues": { + "nameWithoutPrefix": "UIView" + } } ], "functions": [], diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json index 1b5fcc271e61..ee4eb5e27379 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json @@ -364,7 +364,7 @@ "isClass": true, "isFunction": false, "isEnum": false, - "isSimpleClass": true, + "isSimpleClass": false, "isUnknownOrUnsupportedType": false, "customValues": { "objcName": "NSHttpCookie" 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 e9a60045f70e..021ca563fcc1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -246,9 +246,6 @@ abstract class WKWebsiteDataStoreHostApi { /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @HostApi(dartHostTestHandler: 'TestUIViewHostApi') abstract class UIViewHostApi { - @ObjCSelector('contentOffsetForViewWithIdentifier:') - List getContentOffset(int instanceId); - @ObjCSelector('setBackgroundColorForViewWithIdentifier:toValue:') void setBackgroundColor(int instanceId, int? value); @@ -267,7 +264,7 @@ abstract class UIScrollViewHostApi { @ObjCSelector('contentOffsetForScrollViewWithIdentifier:') List getContentOffset(int instanceId); - @ObjCSelector('scrollByForScrollViewWithIdentifier:toX:y:') + @ObjCSelector('scrollByForScrollViewWithIdentifier:x:y:') void scrollBy(int instanceId, double x, double y); @ObjCSelector('setContentOffsetForScrollViewWithIdentifier:toX:y:') 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 4dba81cb21fa..1a62c9267001 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 @@ -21,75 +21,59 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = - _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); void createDefaultDataStore(int instanceId); - Future removeDataOfTypes( - int instanceId, - List dataTypes, - double secondsModifiedSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes(int instanceId, List dataTypes, double secondsModifiedSinceEpoch); + static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_instanceId!); return {}; }); @@ -97,28 +81,20 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = - (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); final double? arg_secondsModifiedSinceEpoch = (args[2] as double?); - assert(arg_secondsModifiedSinceEpoch != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes( - arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); + assert(arg_secondsModifiedSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); return {'result': output}; }); } @@ -129,48 +105,23 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } - abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); - List getContentOffset(int instanceId); void setBackgroundColor(int instanceId, int? value); void setOpaque(int instanceId, bool opaque); - static void setup(TestUIViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.getContentOffset', codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMockMessageHandler(null); - } else { - channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null.'); - final List args = (message as List?)!; - final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.getContentOffset was null, expected non-null int.'); - final List output = api.getContentOffset(arg_instanceId!); - return {'result': output}; - }); - } - } + static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_instanceId!, arg_value); return {}; @@ -179,21 +130,17 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_instanceId!, arg_opaque!); return {}; }); @@ -205,7 +152,6 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } - abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -213,25 +159,20 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int instanceId); void scrollBy(int instanceId, double x, double y); void setContentOffset(int instanceId, double x, double y); - static void setup(TestUIScrollViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -239,18 +180,15 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -258,24 +196,19 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -283,24 +216,19 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -316,48 +244,42 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = - _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); void create(int instanceId); void createFromWebView(int instanceId, int webViewInstanceId); void setAllowsInlineMediaPlayback(int instanceId, bool allow); - void setMediaTypesRequiringUserActionForPlayback( - int instanceId, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, - {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback(int instanceId, List types); + static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -365,22 +287,17 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -388,22 +305,17 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_instanceId!, arg_allow!); return {}; }); @@ -411,26 +323,18 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = - (args[1] as List?) - ?.cast(); - assert(arg_types != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_instanceId!, arg_types!); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = (args[1] as List?)?.cast(); + assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback(arg_instanceId!, arg_types!); return {}; }); } @@ -445,112 +349,91 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = - _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); - void addScriptMessageHandler( - int instanceId, int handlerInstanceid, String name); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void addScriptMessageHandler(int instanceId, int handlerInstanceid, String name); void removeScriptMessageHandler(int instanceId, String name); void removeAllScriptMessageHandlers(int instanceId); void addUserScript(int instanceId, WKUserScriptData userScript); void removeAllUserScripts(int instanceId); - static void setup(TestWKUserContentControllerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerInstanceid = (args[1] as int?); - assert(arg_handlerInstanceid != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerInstanceid != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_instanceId!, arg_handlerInstanceid!, arg_name!); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler(arg_instanceId!, arg_handlerInstanceid!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_instanceId!, arg_name!); return {}; }); @@ -558,19 +441,15 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_instanceId!); return {}; }); @@ -578,23 +457,17 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = - (args[1] as WKUserScriptData?); - assert(arg_userScript != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); + assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_instanceId!, arg_userScript!); return {}; }); @@ -602,19 +475,15 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_instanceId!); return {}; }); @@ -626,56 +495,43 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } - abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration( - int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); void setJavaScriptEnabled(int instanceId, bool enabled); - static void setup(TestWKPreferencesHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_enabled!); return {}; }); @@ -687,28 +543,22 @@ abstract class TestWKPreferencesHostApi { class _TestWKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { const _TestWKScriptMessageHandlerHostApiCodec(); } - abstract class TestWKScriptMessageHandlerHostApi { - static const MessageCodec codec = - _TestWKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = _TestWKScriptMessageHandlerHostApiCodec(); void create(int instanceId); - static void setup(TestWKScriptMessageHandlerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -720,29 +570,23 @@ abstract class TestWKScriptMessageHandlerHostApi { class _TestWKNavigationDelegateHostApiCodec extends StandardMessageCodec { const _TestWKNavigationDelegateHostApiCodec(); } - abstract class TestWKNavigationDelegateHostApi { - static const MessageCodec codec = - _TestWKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = _TestWKNavigationDelegateHostApiCodec(); void create(int instanceId); void setDidFinishNavigation(int instanceId, int? functionInstanceId); - static void setup(TestWKNavigationDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -750,19 +594,15 @@ abstract class TestWKNavigationDelegateHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); final int? arg_functionInstanceId = (args[1] as int?); api.setDidFinishNavigation(arg_instanceId!, arg_functionInstanceId); return {}; @@ -779,46 +619,41 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestNSObjectHostApi { static const MessageCodec codec = _TestNSObjectHostApiCodec(); void dispose(int instanceId); - void addObserver(int instanceId, int observerInstanceId, String keyPath, - List options); + void addObserver(int instanceId, int observerInstanceId, String keyPath, List options); void removeObserver(int instanceId, int observerInstanceId, String keyPath); - static void setup(TestNSObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return {}; }); @@ -826,57 +661,42 @@ abstract class TestNSObjectHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = - (args[3] as List?) - ?.cast(); - assert(arg_options != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_instanceId!, arg_observerInstanceId!, - arg_keyPath!, arg_options!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = (args[3] as List?)?.cast(); + assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!, arg_options!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); return {}; }); } @@ -891,65 +711,72 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -971,25 +798,20 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int instanceId, bool allow); void setCustomUserAgent(int instanceId, String? userAgent); Future evaluateJavaScript(int instanceId, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_configurationInstanceId!); return {}; }); @@ -997,18 +819,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateInstanceId = (args[1] as int?); api.setUIDelegate(arg_instanceId!, arg_uiDelegateInstanceId); return {}; @@ -1017,39 +836,32 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateInstanceId = (args[1] as int?); - api.setNavigationDelegate( - arg_instanceId!, arg_navigationDelegateInstanceId); + api.setNavigationDelegate(arg_instanceId!, arg_navigationDelegateInstanceId); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return {'result': output}; }); @@ -1057,18 +869,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_instanceId!); return {'result': output}; }); @@ -1076,21 +885,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_instanceId!, arg_request!); return {}; }); @@ -1098,21 +903,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_instanceId!, arg_string!, arg_baseUrl); return {}; @@ -1121,24 +922,19 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_instanceId!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -1146,21 +942,17 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_instanceId!, arg_key!); return {}; }); @@ -1168,18 +960,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return {'result': output}; }); @@ -1187,18 +976,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return {'result': output}; }); @@ -1206,18 +992,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return {}; }); @@ -1225,18 +1008,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return {}; }); @@ -1244,18 +1024,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return {}; }); @@ -1263,18 +1040,15 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return {'result': output}; }); @@ -1282,42 +1056,33 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_instanceId!, arg_allow!); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures(arg_instanceId!, arg_allow!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_instanceId!, arg_userAgent); return {}; @@ -1326,23 +1091,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_instanceId!, arg_javaScriptString!); + assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript(arg_instanceId!, arg_javaScriptString!); return {'result': output}; }); } @@ -1353,27 +1113,22 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } - abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int instanceId); - static void setup(TestWKUIDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -1389,79 +1144,67 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = - _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore( - int instanceId, int websiteDataStoreInstanceId); + void createFromWebsiteDataStore(int instanceId, int websiteDataStoreInstanceId); Future setCookie(int instanceId, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreInstanceId = (args[1] as int?); - assert(arg_websiteDataStoreInstanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_instanceId!, arg_websiteDataStoreInstanceId!); + assert(arg_websiteDataStoreInstanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore(arg_instanceId!, arg_websiteDataStoreInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_instanceId!, arg_cookie!); return {}; }); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart index c78527427360..a9f9b2c322c7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i4; @@ -185,10 +185,6 @@ class MockTestUIViewHostApi extends _i1.Mock implements _i2.TestUIViewHostApi { _i1.throwOnMissingStub(this); } - @override - List getContentOffset(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getContentOffset, [instanceId]), - returnValue: []) as List); @override void setBackgroundColor(int? instanceId, int? value) => super.noSuchMethod( Invocation.method(#setBackgroundColor, [instanceId, value]), diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart index 39977d7c63f2..4ffb7d4c19d3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart. // Do not manually edit this file. import 'dart:async' as _i3; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart index b35256d4a2e0..8d7751da785f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart. // Do not manually edit this file. import 'dart:async' as _i3; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart index b5c62fab1a01..066f33a9774e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart @@ -1,5 +1,5 @@ // Mocks generated by Mockito 5.1.0 from annotations -// in webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart. +// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart. // Do not manually edit this file. import 'dart:async' as _i5; From 5bd77f209fc63b507cff6a7eb1ba566ab0d658a7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:23:40 -0700 Subject: [PATCH 12/23] finished nsobject --- .../ios/Runner.xcodeproj/project.pbxproj | 4 + .../ios/RunnerTests/FWFObjectHostApiTests.m | 76 +++++++++ .../webview_flutter_wkwebview/go.sh | 9 +- .../ios/Classes/FWFObjectHostApi.h | 21 +++ .../ios/Classes/FWFObjectHostApi.m | 55 +++++++ .../ios/Classes/webview-umbrella.h | 1 + .../lib/src/foundation/foundation.dart | 25 ++- .../src/foundation/foundation.simple_ast.json | 35 +++- .../lib/src/foundation/output.h | 25 +++ .../lib/src/foundation/output.m | 120 ++++++++++++++ .../lib/src/foundation/output_test.m | 150 ++++++++++++++++++ .../lib/src/web_kit/web_kit.dart | 4 + 12 files changed, 510 insertions(+), 15 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 1baad0d57063..e7519af18e7c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */; }; 8FB79B8F2820BAB300C101D3 /* FWFScrollViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */; }; 8FB79B912820BAC700C101D3 /* FWFUIViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */; }; + 8FB79B972821985200C101D3 /* FWFObjectHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -93,6 +94,7 @@ 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUIDelegateHostApiTests.m; sourceTree = ""; }; 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFScrollViewHostApiTests.m; sourceTree = ""; }; 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFUIViewHostApiTests.m; sourceTree = ""; }; + 8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFObjectHostApiTests.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -165,6 +167,7 @@ 8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */, 8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */, 8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */, + 8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */, ); path = RunnerTests; sourceTree = ""; @@ -464,6 +467,7 @@ files = ( 8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */, 8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */, + 8FB79B972821985200C101D3 /* FWFObjectHostApiTests.m in Sources */, 8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */, 8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */, 8FB79B73282096B500C101D3 /* FWFScriptMessageHandlerHostApiTests.m in Sources */, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m new file mode 100644 index 000000000000..1ebf0ad2b7e9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -0,0 +1,76 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFObjectHostApiTests : XCTestCase +@end + +@implementation FWFObjectHostApiTests +- (void)testAddObserver { + NSObject *mockObject = OCMClassMock([NSObject class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockObject withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; + + NSObject *observerObject = [[NSObject alloc] init]; + [instanceManager addInstance:observerObject withIdentifier:1]; + + FlutterError *error; + [hostApi addObserverForObjectWithIdentifier:@0 + observerIdentifier:@1 + keyPath:@"myKey" + options:@[[FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumOldValue], + [FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumNewValue]] + error:&error]; + + OCMVerify([mockObject addObserver:observerObject forKeyPath:@"myKey" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:nil]); + XCTAssertNil(error); +} + +- (void)testRemoveObserver { + NSObject *mockObject = OCMClassMock([NSObject class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockObject withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + NSObject *observerObject = [[NSObject alloc] init]; + [instanceManager addInstance:observerObject withIdentifier:1]; + + FlutterError *error; + [hostApi removeObserverForObjectWithIdentifier:@0 + observerIdentifier:@1 + keyPath:@"myKey" + error:&error]; + OCMVerify([mockObject removeObserver:observerObject forKeyPath:@"myKey"]); + XCTAssertNil(error); +} + +- (void)testDispose { + NSObject *object = [[NSObject alloc] init]; + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:object withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi disposeObjectWithIdentifier:@0 error:&error]; + XCTAssertEqual([instanceManager identifierForInstance:object], NSNotFound); + XCTAssertNil(error); +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/go.sh b/packages/webview_flutter/webview_flutter_wkwebview/go.sh index 02132c18f9f2..238b4a1e7b29 100755 --- a/packages/webview_flutter/webview_flutter_wkwebview/go.sh +++ b/packages/webview_flutter/webview_flutter_wkwebview/go.sh @@ -4,7 +4,10 @@ #flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h #flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m #flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/ui_kit/ui_kit.simple_ast.json --token-opener /*- lib/src/ui_kit/output.h -flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output_test.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/ui_kit/ui_kit.simple_ast.json --token-opener /*- lib/src/ui_kit/output.h +#flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output.m +#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output_test.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/foundation/output.h +flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/foundation/output.m +flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/foundation/output_test.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h new file mode 100644 index 000000000000..23c38fbe482d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h @@ -0,0 +1,21 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Host api implementation for NSObject. + * + * Handles creating NSObject that intercommunicate with a paired Dart object. + */ +@interface FWFObjectHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m new file mode 100644 index 000000000000..19db72b885df --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -0,0 +1,55 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFObjectHostApi.h" + +@interface FWFObjectHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFObjectHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (NSObject *)objectForIdentifier:(NSNumber *)instanceId { + return (NSObject*) [self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId + observerIdentifier:(nonnull NSNumber *)observer + keyPath:(nonnull NSString *)keyPath + options:(nonnull NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error { + NSKeyValueObservingOptions optionsInt = 0; + for (FWFNSKeyValueObservingOptionsEnumData *data in options) { + optionsInt |= FWFNSKeyValueObservingOptionsFromEnumData(data); + } + [[self objectForIdentifier:instanceId] + addObserver:[self objectForIdentifier:observer] + forKeyPath:keyPath + options:optionsInt + context:nil + ]; +} + +- (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId + observerIdentifier:(nonnull NSNumber *)observer + keyPath:(nonnull NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self objectForIdentifier:instanceId] removeObserver:[self objectForIdentifier:observer] forKeyPath:keyPath]; +} + +- (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + [self.instanceManager removeInstance:[self objectForIdentifier:instanceId]]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index 5cc822889535..d550f55f1773 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -23,3 +23,4 @@ #import #import #import +#import diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index 243a29dd70f3..bdf824c21970 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -9,6 +9,7 @@ import 'package:flutter/services.dart'; import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; +import '../web_kit/web_kit.dart'; import 'foundation_api_impls.dart'; /// The values that can be returned in a change map. @@ -253,10 +254,17 @@ class NSObject { final NSObjectHostApiImpl _api; /// Registers the observer object to receive KVO notifications. + @SimpleMethodAnnotation(customValues: { + 'returnsVoid': true, + 'objcName': 'addObserverForObjectWithIdentifier', + }) Future addObserver( - NSObject observer, { - required String keyPath, - required Set options, + @nsNumber NSObject observer, { + @nsString required String keyPath, + @SimpleTypeAnnotation(customValues: { + 'objcName': 'NSArray' + }) + required Set options, }) { assert(options.isNotEmpty); return _api.addObserverForInstances( @@ -268,11 +276,20 @@ class NSObject { } /// Stops the observer object from receiving change notifications for the property. - Future removeObserver(NSObject observer, {required String keyPath}) { + @SimpleMethodAnnotation(customValues: { + 'returnsVoid': true, + 'objcName': 'removeObserverForObjectWithIdentifier', + }) + Future removeObserver(@nsNumber NSObject observer, + {@nsString required String keyPath}) { return _api.removeObserverForInstances(this, observer, keyPath); } /// Release the reference to the Objective-C object. + @SimpleMethodAnnotation(customValues: { + 'returnsVoid': true, + 'objcName': 'disposeObjectWithIdentifier', + }) Future dispose() { return _api.disposeForInstances(this); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json index 6c15d038b8b6..6182f7865431 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json @@ -48,7 +48,9 @@ "isEnum": false, "isSimpleClass": true, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSObject" + } }, "customValues": {} }, @@ -65,7 +67,9 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSString" + } }, "customValues": {} }, @@ -96,12 +100,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSArray" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "returnsVoid": true, + "objcName": "addObserverForObjectWithIdentifier" + } }, { "name": "removeObserver", @@ -148,7 +157,9 @@ "isEnum": false, "isSimpleClass": true, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSObject" + } }, "customValues": {} }, @@ -165,12 +176,17 @@ "isEnum": false, "isSimpleClass": false, "isUnknownOrUnsupportedType": false, - "customValues": {} + "customValues": { + "objcName": "NSString" + } }, "customValues": {} } ], - "customValues": {} + "customValues": { + "returnsVoid": true, + "objcName": "removeObserverForObjectWithIdentifier" + } }, { "name": "dispose", @@ -204,7 +220,10 @@ "returnsVoid": false, "static": false, "parameters": [], - "customValues": {} + "customValues": { + "returnsVoid": true, + "objcName": "disposeObjectWithIdentifier" + } } ], "constructors": [ diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h new file mode 100644 index 000000000000..46213700e010 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h @@ -0,0 +1,25 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#import + +#import "FWFGeneratedWebKitApis.h" +#import "FWFInstanceManager.h" + +NS_ASSUME_NONNULL_BEGIN + + + +/** + * Host api implementation for NSObject. + * + * Handles creating NSObject that intercommunicate with a paired Dart object. + */ +@interface FWFObjectHostApiImpl : NSObject +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m new file mode 100644 index 000000000000..9264e8d2df64 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m @@ -0,0 +1,120 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "FWFDataConverters.h" +#import "FWFWebViewConfigurationHostApi.h" +#import "FWFObjectHostApi.h" + + + +@interface FWFObjectHostApiImpl () +@property(nonatomic) FWFInstanceManager *instanceManager; +@end + +@implementation FWFObjectHostApiImpl +- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- ( + + NSObject + + *)object ForIdentifier:(NSNumber *)instanceId { + return ( + + + NSObject + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +} + +- (void)createWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + + + NSObject + + * object + = + + + [[NSObject alloc] init]; + + [self.instanceManager addInstance:object + withIdentifier:instanceId.longValue]; +} + +- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId + configurationIdentifier:(nonnull NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error { + WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager + instanceForIdentifier:configurationInstanceId.longValue]; + [self.instanceManager + addInstance:configuration.object + withIdentifier:instanceId.longValue]; +} + + +- (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId + + observer:( + nonnull NSObject *)observer + + keyPath:( + nonnull NSString *)keyPath + + options:( + nonnull NSArray *)options + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self object ForIdentifier:instanceId] addObserver + +:observer + + + keyPath:keyPath + + options:options + + ]; +} + +- (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId + + observer:( + nonnull NSObject *)observer + + keyPath:( + nonnull NSString *)keyPath + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self object ForIdentifier:instanceId] removeObserver + +:observer + + + keyPath:keyPath + + ]; +} + +- (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId + + error:(FlutterError *_Nullable *_Nonnull)error { + + [[self object ForIdentifier:instanceId] dispose + + + ]; +} + +@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m new file mode 100644 index 000000000000..5f8a9a14a79e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m @@ -0,0 +1,150 @@ + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +@import Flutter; +@import XCTest; +@import webview_flutter_wkwebview; + +#import + +@interface FWFObjectHostApiTests : XCTestCase +@end + +@implementation FWFObjectHostApiTests +- (void)testCreateWithIdentifier { + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi createWithIdentifier:@0 error:&error]; + + + NSObject + * object + = ( + + + NSObject + *)[instanceManager instanceForIdentifier:0]; + + + XCTAssertTrue( + [object isKindOfClass:[NSObject + class]]); + + XCTAssertNil(error); +} + + +- (void)test AddObserver { + + + NSObject + *mockObject = OCMClassMock([ + + + NSObject + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockObject withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi addObserverForObjectWithIdentifier:@0 + + observer:aValue + + keyPath:aValue + + options:aValue + + error:&error]; + OCMVerify([mockObject addObserver + +:aValue + + + keyPath:aValue + + options:aValue + + ]); + XCTAssertNil(error); +} + +- (void)test RemoveObserver { + + + NSObject + *mockObject = OCMClassMock([ + + + NSObject + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockObject withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi removeObserverForObjectWithIdentifier:@0 + + observer:aValue + + keyPath:aValue + + error:&error]; + OCMVerify([mockObject removeObserver + +:aValue + + + keyPath:aValue + + ]); + XCTAssertNil(error); +} + +- (void)test Dispose { + + + NSObject + *mockObject = OCMClassMock([ + + + NSObject + + class]); + + FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; + [instanceManager addInstance:mockObject withIdentifier:0]; + + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] + initWithInstanceManager:instanceManager]; + + FlutterError *error; + [hostApi disposeObjectWithIdentifier:@0 + + error:&error]; + OCMVerify([mockObject dispose + + + ]); + XCTAssertNil(error); +} + +@end 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 5174352daf35..9f6eb056cf0c 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 @@ -11,6 +11,10 @@ import '../foundation/foundation.dart'; import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; +const SimpleTypeAnnotation nsObject = SimpleTypeAnnotation( + customValues: {'objcName': 'NSObject'}, +); + const SimpleTypeAnnotation nsString = SimpleTypeAnnotation( customValues: {'objcName': 'NSString'}, ); From 3961002623870eea24e17f1df802a668d9d226f2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:24:26 -0700 Subject: [PATCH 13/23] formatting --- .../ios/RunnerTests/FWFObjectHostApiTests.m | 43 +- .../RunnerTests/FWFScrollViewHostApiTests.m | 26 +- .../ios/RunnerTests/FWFUIViewHostApiTests.m | 16 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 269 +++- .../ios/Classes/FWFGeneratedWebKitApis.m | 1296 ++++++++++------- .../ios/Classes/FWFObjectHostApi.m | 32 +- .../ios/Classes/FWFScrollViewHostApi.m | 37 +- .../ios/Classes/FWFUIViewHostApi.m | 17 +- .../ios/Classes/webview-umbrella.h | 6 +- .../lib/src/common/web_kit.pigeon.dart | 748 ++++++---- .../lib/src/foundation/output.h | 2 - .../lib/src/foundation/output.m | 120 +- .../lib/src/foundation/output_test.m | 100 +- .../lib/src/ui_kit/output.h | 4 - .../lib/src/ui_kit/output.m | 159 +- .../lib/src/ui_kit/output_test.m | 136 +- .../test/src/common/test_web_kit.pigeon.dart | 821 +++++++---- 17 files changed, 2215 insertions(+), 1617 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m index 1ebf0ad2b7e9..831654d0b421 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -18,20 +18,29 @@ - (void)testAddObserver { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockObject withIdentifier:0]; - FWFObjectHostApiImpl *hostApi = [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; - + FWFObjectHostApiImpl *hostApi = + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; + NSObject *observerObject = [[NSObject alloc] init]; [instanceManager addInstance:observerObject withIdentifier:1]; FlutterError *error; - [hostApi addObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 - keyPath:@"myKey" - options:@[[FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumOldValue], - [FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumNewValue]] - error:&error]; - - OCMVerify([mockObject addObserver:observerObject forKeyPath:@"myKey" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:nil]); + [hostApi + addObserverForObjectWithIdentifier:@0 + observerIdentifier:@1 + keyPath:@"myKey" + options:@[ + [FWFNSKeyValueObservingOptionsEnumData + makeWithValue:FWFNSKeyValueObservingOptionsEnumOldValue], + [FWFNSKeyValueObservingOptionsEnumData + makeWithValue:FWFNSKeyValueObservingOptionsEnumNewValue] + ] + error:&error]; + + OCMVerify([mockObject addObserver:observerObject + forKeyPath:@"myKey" + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:nil]); XCTAssertNil(error); } @@ -42,17 +51,16 @@ - (void)testRemoveObserver { [instanceManager addInstance:mockObject withIdentifier:0]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; - + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; + NSObject *observerObject = [[NSObject alloc] init]; [instanceManager addInstance:observerObject withIdentifier:1]; FlutterError *error; [hostApi removeObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 - keyPath:@"myKey" - error:&error]; + observerIdentifier:@1 + keyPath:@"myKey" + error:&error]; OCMVerify([mockObject removeObserver:observerObject forKeyPath:@"myKey"]); XCTAssertNil(error); } @@ -64,8 +72,7 @@ - (void)testDispose { [instanceManager addInstance:object withIdentifier:0]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi disposeObjectWithIdentifier:@0 error:&error]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m index bcf96c291b6d..87d17119e5e7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m @@ -19,14 +19,12 @@ - (void)testGetContentOffset { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addInstance:mockScrollView withIdentifier:0]; - FWFScrollViewHostApiImpl *hostApi = [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + FWFScrollViewHostApiImpl *hostApi = + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - NSArray *expectedValue = @[@1.0, @2.0]; - XCTAssertEqualObjects( - [hostApi contentOffsetForScrollViewWithIdentifier:@0 - error:&error], + NSArray *expectedValue = @[ @1.0, @2.0 ]; + XCTAssertEqualObjects([hostApi contentOffsetForScrollViewWithIdentifier:@0 error:&error], expectedValue); XCTAssertNil(error); } @@ -39,14 +37,10 @@ - (void)testScrollBy { [instanceManager addInstance:scrollView withIdentifier:0]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi scrollByForScrollViewWithIdentifier:@0 - x:@1 - y:@2 - error:&error]; + [hostApi scrollByForScrollViewWithIdentifier:@0 x:@1 y:@2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 2); XCTAssertEqual(scrollView.contentOffset.y, 4); XCTAssertNil(error); @@ -59,14 +53,10 @@ - (void)testSetContentOffset { [instanceManager addInstance:scrollView withIdentifier:0]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setContentOffsetForScrollViewWithIdentifier:@0 - toX:@1 - y:@2 - error:&error]; + [hostApi setContentOffsetForScrollViewWithIdentifier:@0 toX:@1 y:@2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 1); XCTAssertEqual(scrollView.contentOffset.y, 2); XCTAssertNil(error); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m index e037591bea6d..8c7c9c9b45b1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m @@ -19,14 +19,11 @@ - (void)testSetBackgroundColor { [instanceManager addInstance:mockUIView withIdentifier:0]; FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setBackgroundColorForViewWithIdentifier:@0 - toValue:@123 - error:&error]; - + [hostApi setBackgroundColorForViewWithIdentifier:@0 toValue:@123 error:&error]; + OCMVerify([mockUIView setBackgroundColor:[UIColor colorWithRed:(123 >> 16 & 0xff) / 255.0 green:(123 >> 8 & 0xff) / 255.0 blue:(123 & 0xff) / 255.0 @@ -41,13 +38,10 @@ - (void)testSetOpaque { [instanceManager addInstance:mockUIView withIdentifier:0]; FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi setOpaqueForViewWithIdentifier:@0 - isOpaque:@YES - error:&error]; + [hostApi setOpaqueForViewWithIdentifier:@0 isOpaque:@YES error:&error]; OCMVerify([mockUIView setOpaque:YES]); XCTAssertNil(error); } 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 8fe2a9b5a1ac..23b22084f10a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -116,104 +116,166 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; -@property(nonatomic, copy) NSString * url; -@property(nonatomic, copy, nullable) NSString * httpMethod; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * httpBody; -@property(nonatomic, strong) NSDictionary * allHttpHeaderFields; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields; +@property(nonatomic, copy) NSString *url; +@property(nonatomic, copy, nullable) NSString *httpMethod; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; +@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; @end @interface FWFWKUserScriptData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; -@property(nonatomic, copy) NSString * source; -@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData * injectionTime; -@property(nonatomic, strong) NSNumber * isMainFrameOnly; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly; +@property(nonatomic, copy) NSString *source; +@property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; +@property(nonatomic, strong) NSNumber *isMainFrameOnly; @end @interface FWFNSHttpCookieData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray * propertyKeys; -@property(nonatomic, strong) NSArray * propertyValues; + propertyValues:(NSArray *)propertyValues; +@property(nonatomic, strong) NSArray *propertyKeys; +@property(nonatomic, strong) NSArray *propertyValues; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)secondsModifiedSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId + ofTypes:(NSArray *)dataTypes + modifiedSince:(NSNumber *)secondsModifiedSinceEpoch + completion:(void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)instanceId + toValue:(nullable NSNumber *)value + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)instanceId + isOpaque:(NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)instanceId + x:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)instanceId + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId webViewIdentifier:(NSNumber *)webViewInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)instanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)instanceId + forTypes: + (NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error; @end -extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId handlerIdentifier:(NSNumber *)handlerInstanceid ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + handlerIdentifier:(NSNumber *)handlerInstanceid + ofName:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)instanceId + name:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)instanceId + userScript:(FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)instanceId + isEnabled:(NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -222,71 +284,126 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @protocol FWFWKNavigationDelegateHostApi - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId functionIdentifier:(nullable NSNumber *)functionInstanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setDidFinishNavigationForDelegateWithIdentifier:(NSNumber *)instanceId + functionIdentifier:(nullable NSNumber *)functionInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId webViewIdentifier:(NSNumber *)webViewInstanceId URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)functionInstanceId + webViewIdentifier:(NSNumber *)webViewInstanceId + URL:(nullable NSString *)url + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId observerIdentifier:(NSNumber *)observerInstanceId keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + options: + (NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)instanceId + observerIdentifier:(NSNumber *)observerInstanceId + keyPath:(NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFFunctionFlutterApi. NSObject *FWFFunctionFlutterApiGetCodec(void); @interface FWFFunctionFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId completion:(void(^)(NSError *_Nullable))completion; +- (void)disposeFunctionWithIdentifier:(NSNumber *)instanceId + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)instanceId configurationIdentifier:(NSNumber *)configurationInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId delegateIdentifier:(nullable NSNumber *)navigationDelegateInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)instanceId + configurationIdentifier:(NSNumber *)configurationInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier:(nullable NSNumber *)uiDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)instanceId + delegateIdentifier: + (nullable NSNumber *)navigationDelegateInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)instanceId + request:(FWFNSUrlRequestData *)request + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)instanceId + HTMLString:(NSString *)string + baseURL:(nullable NSString *)baseUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)instanceId + fileURL:(NSString *)url + readAccessURL:(NSString *)readAccessUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)instanceId + assetKey:(NSString *)key + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error: + (FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)instanceId + isAllowed:(NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)instanceId + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)instanceId + javaScriptString:(NSString *)javaScriptString + completion:(void (^)(id _Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -295,16 +412,22 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)instanceId + dataStoreIdentifier:(NSNumber *)websiteDataStoreInstanceId + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)instanceId + cookie:(FWFNSHttpCookieData *)cookie + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index 2f72fb2f3889..fa5553334196 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -14,26 +14,25 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code": (error.code ? error.code : [NSNull null]), - @"message": (error.message ? error.message : [NSNull null]), - @"details": (error.details ? error.details : [NSNull null]), - }; + @"code" : (error.code ? error.code : [NSNull null]), + @"message" : (error.message ? error.message : [NSNull null]), + @"details" : (error.details ? error.details : [NSNull null]), + }; } return @{ - @"result": (result ? result : [NSNull null]), - @"error": errorDict, - }; + @"result" : (result ? result : [NSNull null]), + @"error" : errorDict, + }; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface FWFNSKeyValueObservingOptionsEnumData () + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @@ -69,12 +68,14 @@ - (NSDictionary *)toMap; @implementation FWFNSKeyValueObservingOptionsEnumData + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value { - FWFNSKeyValueObservingOptionsEnumData* pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSKeyValueObservingOptionsEnumData *)fromMap:(NSDictionary *)dict { - FWFNSKeyValueObservingOptionsEnumData *pigeonResult = [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; + FWFNSKeyValueObservingOptionsEnumData *pigeonResult = + [[FWFNSKeyValueObservingOptionsEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -85,12 +86,14 @@ - (NSDictionary *)toMap { @implementation FWFWKUserScriptInjectionTimeEnumData + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value { - FWFWKUserScriptInjectionTimeEnumData* pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKUserScriptInjectionTimeEnumData *pigeonResult = [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; + FWFWKUserScriptInjectionTimeEnumData *pigeonResult = + [[FWFWKUserScriptInjectionTimeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -101,12 +104,14 @@ - (NSDictionary *)toMap { @implementation FWFWKAudiovisualMediaTypeEnumData + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value { - FWFWKAudiovisualMediaTypeEnumData* pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict { - FWFWKAudiovisualMediaTypeEnumData *pigeonResult = [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; + FWFWKAudiovisualMediaTypeEnumData *pigeonResult = + [[FWFWKAudiovisualMediaTypeEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -117,7 +122,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -133,12 +138,14 @@ - (NSDictionary *)toMap { @implementation FWFNSHttpCookiePropertyKeyEnumData + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { - FWFNSHttpCookiePropertyKeyEnumData* pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict { - FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; + FWFNSHttpCookiePropertyKeyEnumData *pigeonResult = + [[FWFNSHttpCookiePropertyKeyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } @@ -149,10 +156,10 @@ - (NSDictionary *)toMap { @implementation FWFNSUrlRequestData + (instancetype)makeWithUrl:(NSString *)url - httpMethod:(nullable NSString *)httpMethod - httpBody:(nullable FlutterStandardTypedData *)httpBody - allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { - FWFNSUrlRequestData* pigeonResult = [[FWFNSUrlRequestData alloc] init]; + httpMethod:(nullable NSString *)httpMethod + httpBody:(nullable FlutterStandardTypedData *)httpBody + allHttpHeaderFields:(NSDictionary *)allHttpHeaderFields { + FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = url; pigeonResult.httpMethod = httpMethod; pigeonResult.httpBody = httpBody; @@ -170,15 +177,22 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", (self.httpMethod ? self.httpMethod : [NSNull null]), @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), @"httpBody", (self.allHttpHeaderFields ? self.allHttpHeaderFields : [NSNull null]), @"allHttpHeaderFields", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", + (self.httpMethod ? self.httpMethod : [NSNull null]), + @"httpMethod", (self.httpBody ? self.httpBody : [NSNull null]), + @"httpBody", + (self.allHttpHeaderFields ? self.allHttpHeaderFields + : [NSNull null]), + @"allHttpHeaderFields", nil]; } @end @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source - injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { - FWFWKUserScriptData* pigeonResult = [[FWFWKUserScriptData alloc] init]; + injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime + isMainFrameOnly:(NSNumber *)isMainFrameOnly { + FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; pigeonResult.isMainFrameOnly = isMainFrameOnly; @@ -188,20 +202,27 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = + [FWFWKUserScriptInjectionTimeEnumData fromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", (self.injectionTime ? [self.injectionTime toMap] : [NSNull null]), @"injectionTime", (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), @"isMainFrameOnly", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.source ? self.source : [NSNull null]), @"source", + (self.injectionTime ? [self.injectionTime toMap] + : [NSNull null]), + @"injectionTime", + (self.isMainFrameOnly ? self.isMainFrameOnly : [NSNull null]), + @"isMainFrameOnly", nil]; } @end @implementation FWFNSHttpCookieData + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys - propertyValues:(NSArray *)propertyValues { - FWFNSHttpCookieData* pigeonResult = [[FWFNSHttpCookieData alloc] init]; + propertyValues:(NSArray *)propertyValues { + FWFNSHttpCookieData *pigeonResult = [[FWFNSHttpCookieData alloc] init]; pigeonResult.propertyKeys = propertyKeys; pigeonResult.propertyValues = propertyValues; return pigeonResult; @@ -215,22 +236,24 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { return pigeonResult; } - (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), @"propertyKeys", (self.propertyValues ? self.propertyValues : [NSNull null]), @"propertyValues", nil]; + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.propertyKeys ? self.propertyKeys : [NSNull null]), + @"propertyKeys", + (self.propertyValues ? self.propertyValues : [NSNull null]), + @"propertyValues", nil]; } @end @interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebsiteDataStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -238,13 +261,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebsiteDataStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebsiteDataStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -265,43 +286,52 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; + FWFWKWebsiteDataStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebsiteDataStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createDefaultDataStoreWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -309,30 +339,36 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes modifiedSince:arg_secondsModifiedSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_instanceId + ofTypes:arg_dataTypes + modifiedSince:arg_secondsModifiedSinceEpoch + completion:^(NSNumber *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -362,22 +398,26 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIViewHostApiCodecReaderWriter *readerWriter = [[FWFUIViewHostApiCodecReaderWriter alloc] init]; + FWFUIViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: + toValue:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -386,19 +426,20 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setBackgroundColorForViewWithIdentifier:arg_instanceId toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -407,8 +448,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setOpaqueForViewWithIdentifier:arg_instanceId isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -438,63 +478,72 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; + FWFUIScrollViewHostApiCodecReaderWriter *readerWriter = + [[FWFUIScrollViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(scrollByForScrollViewWithIdentifier:x:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -504,30 +553,34 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO [api scrollByForScrollViewWithIdentifier:arg_instanceId x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId toX:arg_x y:arg_y error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_instanceId + toX:arg_x + y:arg_y + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -535,15 +588,13 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO @interface FWFWKWebViewConfigurationHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewConfigurationHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -551,13 +602,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewConfigurationHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewConfigurationHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -578,22 +627,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewConfigurationHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -601,71 +653,87 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_instanceId webViewIdentifier:arg_webViewInstanceId error:&error]; + [api createFromWebViewWithIdentifier:arg_instanceId + webViewIdentifier:arg_webViewInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." + @"setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: + forTypes:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId forTypes:arg_types error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_instanceId + forTypes:arg_types + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -673,18 +741,16 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -692,17 +758,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUserContentControllerHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUserContentControllerHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -723,86 +786,109 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; + FWFWKUserContentControllerHostApiCodecReaderWriter *readerWriter = + [[FWFWKUserContentControllerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addScriptMessageHandlerForControllerWithIdentifier: + handlerIdentifier:ofName:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" + @"ofName:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerInstanceid = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId handlerIdentifier:arg_handlerInstanceid ofName:arg_name error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + handlerIdentifier:arg_handlerInstanceid + ofName:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId name:arg_name error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_instanceId + name:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -810,40 +896,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: + userScript:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_instanceId userScript:arg_userScript error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_instanceId + userScript:arg_userScript + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllUserScriptsForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -851,8 +943,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -882,53 +973,63 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; + FWFWKPreferencesHostApiCodecReaderWriter *readerWriter = + [[FWFWKPreferencesHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(createFromWebViewConfigurationWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewConfigurationWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId isEnabled:arg_enabled error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_instanceId + isEnabled:arg_enabled + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -958,22 +1059,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerHostApiCodecReaderWriter *readerWriter = + [[FWFWKScriptMessageHandlerHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKScriptMessageHandlerHostApiGetCodec() ]; + codec:FWFWKScriptMessageHandlerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKScriptMessageHandlerHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -981,8 +1085,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1012,22 +1115,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1035,29 +1141,33 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation" binaryMessenger:binaryMessenger - codec:FWFWKNavigationDelegateHostApiGetCodec() ]; + codec:FWFWKNavigationDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to @selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)], + @"FWFWKNavigationDelegateHostApi api (%@) doesn't respond to " + @"@selector(setDidFinishNavigationForDelegateWithIdentifier:functionIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_functionInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId functionIdentifier:arg_functionInstanceId error:&error]; + [api setDidFinishNavigationForDelegateWithIdentifier:arg_instanceId + functionIdentifier:arg_functionInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1087,15 +1197,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKNavigationDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKNavigationDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKNavigationDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKNavigationDelegateFlutterApi @@ -1107,29 +1217,35 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId webViewIdentifier:(NSNumber *)arg_webViewInstanceId URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, (arg_url == nil) ? [NSNull null] : arg_url] reply:^(id reply) { - completion(nil); - }]; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_functionInstanceId + webViewIdentifier:(NSNumber *)arg_webViewInstanceId + URL:(nullable NSString *)arg_url + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + (arg_functionInstanceId == nil) ? [NSNull null] : arg_functionInstanceId, + (arg_webViewInstanceId == nil) ? [NSNull null] : arg_webViewInstanceId, + (arg_url == nil) ? [NSNull null] : arg_url + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1137,13 +1253,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1164,22 +1278,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectHostApiCodecReaderWriter *readerWriter = [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; + FWFNSObjectHostApiCodecReaderWriter *readerWriter = + [[FWFNSObjectHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.dispose" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(disposeObjectWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(disposeObjectWithIdentifier:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(disposeObjectWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1187,53 +1304,67 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec [api disposeObjectWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addObserverForObjectWithIdentifier: + observerIdentifier:keyPath:options:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = + GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath options:arg_options error:&error]; + [api addObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + options:arg_options + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: + observerIdentifier:keyPath:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerInstanceId = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_instanceId observerIdentifier:arg_observerInstanceId keyPath:arg_keyPath error:&error]; + [api removeObserverForObjectWithIdentifier:arg_instanceId + observerIdentifier:arg_observerInstanceId + keyPath:arg_keyPath + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1263,15 +1394,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFFunctionFlutterApiCodecReaderWriter *readerWriter = [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; + FWFFunctionFlutterApiCodecReaderWriter *readerWriter = + [[FWFFunctionFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFFunctionFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFFunctionFlutterApi @@ -1283,50 +1414,49 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)disposeFunctionWithIdentifier:(NSNumber *)arg_instanceId + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FunctionFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFFunctionFlutterApiGetCodec()]; - [channel sendMessage:@[(arg_instanceId == nil) ? [NSNull null] : arg_instanceId] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFFunctionFlutterApiGetCodec()]; + [channel sendMessage:@[ (arg_instanceId == nil) ? [NSNull null] : arg_instanceId ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1334,41 +1464,32 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1389,85 +1510,101 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewHostApiCodecReaderWriter *readerWriter = [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; + FWFWKWebViewHostApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:configurationIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(createWithIdentifier:configurationIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier: + configurationIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:configurationIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_instanceId configurationIdentifier:arg_configurationInstanceId error:&error]; + [api createWithIdentifier:arg_instanceId + configurationIdentifier:arg_configurationInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_uiDelegateInstanceId error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_uiDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId delegateIdentifier:arg_navigationDelegateInstanceId error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_instanceId + delegateIdentifier:arg_navigationDelegateInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(URLForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1475,39 +1612,44 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api URLForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: + error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_instanceId + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: + request:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1516,63 +1658,75 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadRequestForWebViewWithIdentifier:arg_instanceId request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: + HTMLString:baseURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_instanceId HTMLString:arg_string baseURL:arg_baseUrl error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_instanceId + HTMLString:arg_string + baseURL:arg_baseUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); + NSCAssert([api respondsToSelector:@selector + (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_instanceId fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; + [api loadFileForWebViewWithIdentifier:arg_instanceId + fileURL:arg_url + readAccessURL:arg_readAccessUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: + assetKey:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1581,19 +1735,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadAssetForWebViewWithIdentifier:arg_instanceId assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1601,19 +1756,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1621,19 +1777,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1641,19 +1798,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goBackForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1661,19 +1819,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goForwardForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(reloadWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1681,19 +1840,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api reloadWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(titleForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1701,71 +1861,85 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api titleForWebViewWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId isAllowed:arg_allow error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_instanceId + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: + userAgent:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_instanceId userAgent:arg_userAgent error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_instanceId + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_instanceId + javaScriptString:arg_javaScriptString + completion:^(id _Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1795,22 +1969,25 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateHostApiCodecReaderWriter *readerWriter = + [[FWFWKUIDelegateHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUIDelegateHostApi.create" binaryMessenger:binaryMessenger - codec:FWFWKUIDelegateHostApiGetCodec() ]; + codec:FWFWKUIDelegateHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], @"FWFWKUIDelegateHostApi api (%@) doesn't respond to @selector(createWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createWithIdentifier:error:)], + @"FWFWKUIDelegateHostApi api (%@) doesn't respond to " + @"@selector(createWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); @@ -1818,8 +1995,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO [api createWithIdentifier:arg_instanceId error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1827,18 +2003,16 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1846,17 +2020,14 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKHttpCookieStoreHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKHttpCookieStoreHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1877,53 +2048,62 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; + FWFWKHttpCookieStoreHostApiCodecReaderWriter *readerWriter = + [[FWFWKHttpCookieStoreHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *api) { +void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebsiteDataStoreWithIdentifier: + dataStoreIdentifier:error:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(createFromWebsiteDataStoreWithIdentifier:dataStoreIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreInstanceId = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId dataStoreIdentifier:arg_websiteDataStoreInstanceId error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_instanceId + dataStoreIdentifier:arg_websiteDataStoreInstanceId + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: + cookie:completion:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_instanceId cookie:arg_cookie completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_instanceId + cookie:arg_cookie + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index 19db72b885df..000e9e9f34ad 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFDataConverters.h" #import "FWFObjectHostApi.h" +#import "FWFDataConverters.h" @interface FWFObjectHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -19,36 +19,36 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - (NSObject *)objectForIdentifier:(NSNumber *)instanceId { - return (NSObject*) [self.instanceManager instanceForIdentifier:instanceId.longValue]; + return (NSObject *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId observerIdentifier:(nonnull NSNumber *)observer keyPath:(nonnull NSString *)keyPath - options:(nonnull NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error { + options: + (nonnull NSArray *) + options + error:(FlutterError *_Nullable *_Nonnull)error { NSKeyValueObservingOptions optionsInt = 0; for (FWFNSKeyValueObservingOptionsEnumData *data in options) { optionsInt |= FWFNSKeyValueObservingOptionsFromEnumData(data); } - [[self objectForIdentifier:instanceId] - addObserver:[self objectForIdentifier:observer] - forKeyPath:keyPath - options:optionsInt - context:nil - ]; + [[self objectForIdentifier:instanceId] addObserver:[self objectForIdentifier:observer] + forKeyPath:keyPath + options:optionsInt + context:nil]; } - (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - observerIdentifier:(nonnull NSNumber *)observer - keyPath:(nonnull NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self objectForIdentifier:instanceId] removeObserver:[self objectForIdentifier:observer] forKeyPath:keyPath]; + observerIdentifier:(nonnull NSNumber *)observer + keyPath:(nonnull NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error { + [[self objectForIdentifier:instanceId] removeObserver:[self objectForIdentifier:observer] + forKeyPath:keyPath]; } - (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { + error:(FlutterError *_Nullable *_Nonnull)error { [self.instanceManager removeInstance:[self objectForIdentifier:instanceId]]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m index ea2e4d352f79..d34ba7fd3829 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FWFWebViewHostApi.h" #import "FWFScrollViewHostApi.h" +#import "FWFWebViewHostApi.h" @interface FWFScrollViewHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -18,11 +18,10 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (UIScrollView*)scrollViewForIdentifier:(NSNumber *)instanceId { - return (UIScrollView*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; +- (UIScrollView *)scrollViewForIdentifier:(NSNumber *)instanceId { + return (UIScrollView *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - - (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId webViewIdentifier:(nonnull NSNumber *)webViewInstanceId error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -31,29 +30,29 @@ - (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)instanceId [self.instanceManager addInstance:webView.scrollView withIdentifier:instanceId.longValue]; } - -- (NSArray *)contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - CGPoint point = [[self scrollViewForIdentifier:instanceId] contentOffset]; - return @[@(point.x), @(point.y)]; +- (NSArray *) + contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + error:(FlutterError *_Nullable *_Nonnull)error { + CGPoint point = [[self scrollViewForIdentifier:instanceId] contentOffset]; + return @[ @(point.x), @(point.y) ]; } - (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - x:(nonnull NSNumber *)x - y:(nonnull NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error { + x:(nonnull NSNumber *)x + y:(nonnull NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error { UIScrollView *scrollView = [self scrollViewForIdentifier:instanceId]; CGPoint contentOffset = scrollView.contentOffset; -[scrollView - setContentOffset:CGPointMake(contentOffset.x + x.doubleValue, contentOffset.y + y.doubleValue)]; + [scrollView setContentOffset:CGPointMake(contentOffset.x + x.doubleValue, + contentOffset.y + y.doubleValue)]; } -- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId toX:(nonnull NSNumber *)x +- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId + toX:(nonnull NSNumber *)x y:(nonnull NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error { - -[[self scrollViewForIdentifier:instanceId] setContentOffset -:CGPointMake(x.doubleValue, y.doubleValue) - ]; + error:(FlutterError *_Nullable *_Nonnull)error { + [[self scrollViewForIdentifier:instanceId] + setContentOffset:CGPointMake(x.doubleValue, y.doubleValue)]; } @end 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 69586bf869db..90582323539c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -18,27 +18,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - (UIView *)viewForIdentifier:(NSNumber *)instanceId { - return (UIView*)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + return (UIView *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - - (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)instanceId - toValue:(nullable NSNumber *)color - error:(FlutterError *_Nullable *_Nonnull)error { + toValue:(nullable NSNumber *)color + error:(FlutterError *_Nullable *_Nonnull)error { if (!color) { [[self viewForIdentifier:instanceId] setBackgroundColor:nil]; } int colorInt = color.intValue; UIColor *colorObject = [UIColor colorWithRed:(colorInt >> 16 & 0xff) / 255.0 - green:(colorInt >> 8 & 0xff) / 255.0 - blue:(colorInt & 0xff) / 255.0 - alpha:(colorInt >> 24 & 0xff) / 255.0]; + green:(colorInt >> 8 & 0xff) / 255.0 + blue:(colorInt & 0xff) / 255.0 + alpha:(colorInt >> 24 & 0xff) / 255.0]; [[self viewForIdentifier:instanceId] setBackgroundColor:colorObject]; } - (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId - isOpaque:(nonnull NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error { + isOpaque:(nonnull NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error { [[self viewForIdentifier:instanceId] setOpaque:opaque.boolValue]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h index d550f55f1773..0aa409e4b31f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h @@ -12,15 +12,15 @@ #import #import #import +#import #import #import +#import #import +#import #import #import #import #import #import #import -#import -#import -#import 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 2bad9b9ceffe..e7ee130a35c3 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 @@ -221,7 +221,9 @@ class NSUrlRequestData { url: pigeonMap['url']! as String, httpMethod: pigeonMap['httpMethod'] as String?, httpBody: pigeonMap['httpBody'] as Uint8List?, - allHttpHeaderFields: (pigeonMap['allHttpHeaderFields'] as Map?)!.cast(), + allHttpHeaderFields: + (pigeonMap['allHttpHeaderFields'] as Map?)! + .cast(), ); } } @@ -250,7 +252,8 @@ class WKUserScriptData { return WKUserScriptData( source: pigeonMap['source']! as String, injectionTime: pigeonMap['injectionTime'] != null - ? WKUserScriptInjectionTimeEnumData.decode(pigeonMap['injectionTime']!) + ? WKUserScriptInjectionTimeEnumData.decode( + pigeonMap['injectionTime']!) : null, isMainFrameOnly: pigeonMap['isMainFrameOnly']! as bool, ); @@ -276,8 +279,10 @@ class NSHttpCookieData { static NSHttpCookieData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookieData( - propertyKeys: (pigeonMap['propertyKeys'] as List?)!.cast(), - propertyValues: (pigeonMap['propertyValues'] as List?)!.cast(), + propertyKeys: (pigeonMap['propertyKeys'] as List?)! + .cast(), + propertyValues: + (pigeonMap['propertyValues'] as List?)!.cast(), ); } } @@ -289,20 +294,19 @@ class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -311,24 +315,30 @@ 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; + WKWebsiteDataStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebsiteDataStoreHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -341,7 +351,9 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -350,7 +362,8 @@ class WKWebsiteDataStoreHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -361,18 +374,26 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes(int arg_instanceId, List arg_dataTypes, double arg_secondsModifiedSinceEpoch) async { + Future removeDataOfTypes( + int arg_instanceId, + List arg_dataTypes, + double arg_secondsModifiedSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_dataTypes, arg_secondsModifiedSinceEpoch]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_dataTypes, + arg_secondsModifiedSinceEpoch + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -397,7 +418,8 @@ 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; + UIViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -405,16 +427,18 @@ class UIViewHostApi { Future setBackgroundColor(int arg_instanceId, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_value]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -427,16 +451,18 @@ class UIViewHostApi { Future setOpaque(int arg_instanceId, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_opaque]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -456,24 +482,29 @@ 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; + UIScrollViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _UIScrollViewHostApiCodec(); - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -486,7 +517,8 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -495,7 +527,8 @@ class UIScrollViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -513,16 +546,19 @@ class UIScrollViewHostApi { Future scrollBy(int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -533,18 +569,22 @@ class UIScrollViewHostApi { } } - Future setContentOffset(int arg_instanceId, double arg_x, double arg_y) async { + Future setContentOffset( + int arg_instanceId, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_x, arg_y]) as Map?; + await channel.send([arg_instanceId, arg_x, arg_y]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -563,20 +603,19 @@ class _WKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -585,15 +624,18 @@ 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; + WKWebViewConfigurationHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _WKWebViewConfigurationHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -602,7 +644,8 @@ class WKWebViewConfigurationHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -613,18 +656,23 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView(int arg_instanceId, int arg_webViewInstanceId) async { + Future createFromWebView( + int arg_instanceId, int arg_webViewInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -635,18 +683,22 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback(int arg_instanceId, bool arg_allow) async { + Future setAllowsInlineMediaPlayback( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -657,18 +709,22 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_instanceId, + List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_types]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -687,27 +743,25 @@ class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -716,24 +770,31 @@ 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; + WKUserContentControllerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _WKUserContentControllerHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -744,18 +805,23 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler(int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { + Future addScriptMessageHandler( + int arg_instanceId, int arg_handlerInstanceid, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_handlerInstanceid, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_handlerInstanceid, arg_name]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -766,18 +832,22 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler(int arg_instanceId, String arg_name) async { + Future removeScriptMessageHandler( + int arg_instanceId, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_name]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -790,7 +860,9 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -799,7 +871,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -810,18 +883,23 @@ class WKUserContentControllerHostApi { } } - Future addUserScript(int arg_instanceId, WKUserScriptData arg_userScript) async { + Future addUserScript( + int arg_instanceId, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userScript]) as Map?; + await channel.send([arg_instanceId, arg_userScript]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -834,7 +912,9 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -843,7 +923,8 @@ class WKUserContentControllerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -863,24 +944,30 @@ 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; + WKPreferencesHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKPreferencesHostApiCodec(); - Future createFromWebViewConfiguration(int arg_instanceId, int arg_configurationInstanceId) async { + Future createFromWebViewConfiguration( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -891,18 +978,21 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled(int arg_instanceId, bool arg_enabled) async { + Future setJavaScriptEnabled( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_enabled]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -922,15 +1012,18 @@ 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; + WKScriptMessageHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = + _WKScriptMessageHandlerHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -939,7 +1032,8 @@ class WKScriptMessageHandlerHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -959,15 +1053,18 @@ 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; + WKNavigationDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _WKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateHostApiCodec(); Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -976,7 +1073,8 @@ class WKNavigationDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -987,18 +1085,23 @@ class WKNavigationDelegateHostApi { } } - Future setDidFinishNavigation(int arg_instanceId, int? arg_functionInstanceId) async { + Future setDidFinishNavigation( + int arg_instanceId, int? arg_functionInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_functionInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_functionInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1013,26 +1116,36 @@ class WKNavigationDelegateHostApi { class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { const _WKNavigationDelegateFlutterApiCodec(); } + abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateFlutterApiCodec(); - void didFinishNavigation(int functionInstanceId, int webViewInstanceId, String? url); - static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void didFinishNavigation( + int functionInstanceId, int webViewInstanceId, String? url); + static void setup(WKNavigationDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_functionInstanceId = (args[0] as int?); - assert(arg_functionInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_functionInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation(arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); + api.didFinishNavigation( + arg_functionInstanceId!, arg_webViewInstanceId!, arg_url); return; }); } @@ -1047,20 +1160,19 @@ class _NSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1069,7 +1181,8 @@ 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; + NSObjectHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1077,7 +1190,8 @@ class NSObjectHostApi { Future dispose(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1086,7 +1200,8 @@ class NSObjectHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1097,18 +1212,28 @@ class NSObjectHostApi { } } - Future addObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath, List arg_options) async { + Future addObserver( + int arg_instanceId, + int arg_observerInstanceId, + String arg_keyPath, + List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath, arg_options]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_instanceId, + arg_observerInstanceId, + arg_keyPath, + arg_options + ]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1119,18 +1244,22 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_instanceId, int arg_observerInstanceId, String arg_keyPath) async { + Future removeObserver(int arg_instanceId, int arg_observerInstanceId, + String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_observerInstanceId, arg_keyPath]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send( + [arg_instanceId, arg_observerInstanceId, arg_keyPath]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1145,22 +1274,27 @@ class NSObjectHostApi { class _FunctionFlutterApiCodec extends StandardMessageCodec { const _FunctionFlutterApiCodec(); } + abstract class FunctionFlutterApi { static const MessageCodec codec = _FunctionFlutterApiCodec(); void dispose(int instanceId); - static void setup(FunctionFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FunctionFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.FunctionFlutterApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.FunctionFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return; }); @@ -1176,69 +1310,61 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1247,24 +1373,29 @@ 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; + WKWebViewHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKWebViewHostApiCodec(); - Future create(int arg_instanceId, int arg_configurationInstanceId) async { + Future create( + int arg_instanceId, int arg_configurationInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_configurationInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_configurationInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1275,18 +1406,22 @@ class WKWebViewHostApi { } } - Future setUIDelegate(int arg_instanceId, int? arg_uiDelegateInstanceId) async { + Future setUIDelegate( + int arg_instanceId, int? arg_uiDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) as Map?; + await channel.send([arg_instanceId, arg_uiDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1297,18 +1432,22 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate(int arg_instanceId, int? arg_navigationDelegateInstanceId) async { + Future setNavigationDelegate( + int arg_instanceId, int? arg_navigationDelegateInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_navigationDelegateInstanceId]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_navigationDelegateInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1321,7 +1460,8 @@ class WKWebViewHostApi { Future getUrl(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1330,7 +1470,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1343,7 +1484,8 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1352,7 +1494,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1368,18 +1511,21 @@ class WKWebViewHostApi { } } - Future loadRequest(int arg_instanceId, NSUrlRequestData arg_request) async { + Future loadRequest( + int arg_instanceId, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_request]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1390,18 +1536,22 @@ class WKWebViewHostApi { } } - Future loadHtmlString(int arg_instanceId, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString( + int arg_instanceId, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_string, arg_baseUrl]) as Map?; + await channel.send([arg_instanceId, arg_string, arg_baseUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1412,18 +1562,22 @@ class WKWebViewHostApi { } } - Future loadFileUrl(int arg_instanceId, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl( + int arg_instanceId, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_url, arg_readAccessUrl]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_url, arg_readAccessUrl]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1436,16 +1590,18 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_instanceId, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_key]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1458,7 +1614,8 @@ class WKWebViewHostApi { Future canGoBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1467,7 +1624,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1485,7 +1643,8 @@ class WKWebViewHostApi { Future canGoForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1494,7 +1653,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1512,7 +1672,8 @@ class WKWebViewHostApi { Future goBack(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1521,7 +1682,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1534,7 +1696,8 @@ class WKWebViewHostApi { Future goForward(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1543,7 +1706,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1556,7 +1720,8 @@ class WKWebViewHostApi { Future reload(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1565,7 +1730,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1578,7 +1744,8 @@ class WKWebViewHostApi { Future getTitle(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1587,7 +1754,8 @@ class WKWebViewHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1598,18 +1766,22 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures(int arg_instanceId, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures( + int arg_instanceId, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_allow]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1620,18 +1792,22 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent(int arg_instanceId, String? arg_userAgent) async { + Future setCustomUserAgent( + int arg_instanceId, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_userAgent]) as Map?; + await channel.send([arg_instanceId, arg_userAgent]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1642,18 +1818,22 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript(int arg_instanceId, String arg_javaScriptString) async { + Future evaluateJavaScript( + int arg_instanceId, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_instanceId, arg_javaScriptString]) as Map?; + await channel.send([arg_instanceId, arg_javaScriptString]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1673,7 +1853,8 @@ 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; + WKUIDelegateHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; @@ -1681,7 +1862,8 @@ class WKUIDelegateHostApi { Future create(int arg_instanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([arg_instanceId]) as Map?; if (replyMap == null) { @@ -1690,7 +1872,8 @@ class WKUIDelegateHostApi { message: 'Unable to establish connection on channel.', ); } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1709,27 +1892,25 @@ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1738,24 +1919,30 @@ 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; + WKHttpCookieStoreHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _WKHttpCookieStoreHostApiCodec(); - Future createFromWebsiteDataStore(int arg_instanceId, int arg_websiteDataStoreInstanceId) async { + Future createFromWebsiteDataStore( + int arg_instanceId, int arg_websiteDataStoreInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_websiteDataStoreInstanceId]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_websiteDataStoreInstanceId]) + as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, @@ -1766,18 +1953,21 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie(int arg_instanceId, NSHttpCookieData arg_cookie) async { + Future setCookie( + int arg_instanceId, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_instanceId, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_instanceId, arg_cookie]) as Map?; if (replyMap == 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?)!; + final Map error = + (replyMap['error'] as Map?)!; throw PlatformException( code: (error['code'] as String?)!, message: error['message'] as String?, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h index 46213700e010..000ca7280099 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h @@ -11,8 +11,6 @@ NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for NSObject. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m index 9264e8d2df64..b7795c2e444f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m @@ -4,10 +4,8 @@ // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFObjectHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFObjectHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -23,32 +21,27 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - NSObject - - *)object ForIdentifier:(NSNumber *)instanceId { + + NSObject + + *)object +ForIdentifier:(NSNumber *)instanceId { return ( - - - NSObject - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + NSObject + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - NSObject - - * object - = - - - [[NSObject alloc] init]; - - [self.instanceManager addInstance:object - withIdentifier:instanceId.longValue]; + NSObject + + *object = + + [[NSObject alloc] init]; + + [self.instanceManager addInstance:object withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -56,64 +49,51 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.object - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.object withIdentifier:instanceId.longValue]; } - - (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - - observer:( - nonnull NSObject *)observer - - keyPath:( - nonnull NSString *)keyPath - - options:( - nonnull NSArray *)options - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self object ForIdentifier:instanceId] addObserver - -:observer - - - keyPath:keyPath - - options:options - + + observer:(nonnull NSObject *)observer + + keyPath:(nonnull NSString *)keyPath + + options:(nonnull NSArray *) + options + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self object ForIdentifier:instanceId] addObserver + + :observer + + keyPath:keyPath + + options:options + ]; } - (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - - observer:( - nonnull NSObject *)observer - - keyPath:( - nonnull NSString *)keyPath - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self object ForIdentifier:instanceId] removeObserver - -:observer - - - keyPath:keyPath - + + observer:(nonnull NSObject *)observer + + keyPath:(nonnull NSString *)keyPath + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self object ForIdentifier:instanceId] removeObserver + + :observer + + keyPath:keyPath + ]; } - (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self object ForIdentifier:instanceId] dispose - + error:(FlutterError *_Nullable *_Nonnull)error { + [[self object ForIdentifier:instanceId] dispose + ]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m index 5f8a9a14a79e..bd95e5447e59 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m @@ -16,34 +16,22 @@ @implementation FWFObjectHostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - NSObject - * object - = ( - - - NSObject - *)[instanceManager instanceForIdentifier:0]; - - - XCTAssertTrue( - [object isKindOfClass:[NSObject - class]]); - + + NSObject *object = ( + + NSObject *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([object isKindOfClass:[NSObject class]]); + XCTAssertNil(error); } - - (void)test AddObserver { - - - NSObject + NSObject *mockObject = OCMClassMock([ @@ -55,36 +43,32 @@ - (void)test AddObserver { [instanceManager addInstance:mockObject withIdentifier:0]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi addObserverForObjectWithIdentifier:@0 - - observer:aValue - + + observer:aValue + + keyPath:aValue + + options:aValue + + error:&error]; + OCMVerify([mockObject addObserver + + :aValue + keyPath:aValue - + options:aValue - - error:&error]; - OCMVerify([mockObject addObserver -:aValue - - - keyPath:aValue - - options:aValue - ]); XCTAssertNil(error); } - (void)test RemoveObserver { - - - NSObject + NSObject *mockObject = OCMClassMock([ @@ -96,32 +80,28 @@ - (void)test RemoveObserver { [instanceManager addInstance:mockObject withIdentifier:0]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi removeObserverForObjectWithIdentifier:@0 - - observer:aValue - - keyPath:aValue - - error:&error]; + + observer:aValue + + keyPath:aValue + + error:&error]; OCMVerify([mockObject removeObserver -:aValue - - - keyPath:aValue - + :aValue + + keyPath:aValue + ]); XCTAssertNil(error); } - (void)test Dispose { - - - NSObject + NSObject *mockObject = OCMClassMock([ @@ -133,16 +113,14 @@ - (void)test Dispose { [instanceManager addInstance:mockObject withIdentifier:0]; FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi disposeObjectWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockObject dispose - ]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h index 78977a890ef9..7010adbb5797 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h @@ -11,8 +11,6 @@ NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for UIScrollView. * @@ -36,8 +34,6 @@ NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_BEGIN - - /** * Host api implementation for UIView. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m index bb34fb3db17a..97870e7f46d9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m @@ -4,10 +4,8 @@ // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFScrollViewHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFScrollViewHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -23,32 +21,27 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - UIScrollView - - *)scrollView ForIdentifier:(NSNumber *)instanceId { + + UIScrollView + + *)scrollView +ForIdentifier:(NSNumber *)instanceId { return ( - - - UIScrollView - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + UIScrollView + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - UIScrollView - - * scrollView - = - - - [[UIScrollView alloc] init]; - - [self.instanceManager addInstance:scrollView - withIdentifier:instanceId.longValue]; + UIScrollView + + *scrollView = + + [[UIScrollView alloc] init]; + + [self.instanceManager addInstance:scrollView withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -56,49 +49,38 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.scrollView - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.scrollView withIdentifier:instanceId.longValue]; } - - (void)contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - return - [[self scrollView ForIdentifier:instanceId] getContentOffset - + error:(FlutterError *_Nullable *_Nonnull)error { + return [[self scrollView ForIdentifier:instanceId] getContentOffset + ]; } - (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - offset:( - nonnull NSNumber *)offset - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self scrollView ForIdentifier:instanceId] scrollBy + + offset:(nonnull NSNumber *)offset + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self scrollView ForIdentifier:instanceId] scrollBy :offset - - + ]; } - (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - offset:( - nonnull NSNumber *)offset - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self scrollView ForIdentifier:instanceId] setContentOffset + + offset:(nonnull NSNumber *)offset + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self scrollView ForIdentifier:instanceId] setContentOffset :offset - - + ]; } @@ -109,10 +91,8 @@ - (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instance // found in the LICENSE file. #import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" #import "FWFUIViewHostApi.h" - - +#import "FWFWebViewConfigurationHostApi.h" @interface FWFUIViewHostApiImpl () @property(nonatomic) FWFInstanceManager *instanceManager; @@ -128,32 +108,27 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { } - ( - - UIView - - *)uIView ForIdentifier:(NSNumber *)instanceId { + + UIView + + *)uIView +ForIdentifier:(NSNumber *)instanceId { return ( - - - UIView - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; + + UIView + + *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; } - (void)createWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - - - UIView - - * uIView - = - - - [[UIView alloc] init]; - - [self.instanceManager addInstance:uIView - withIdentifier:instanceId.longValue]; + UIView + + *uIView = + + [[UIView alloc] init]; + + [self.instanceManager addInstance:uIView withIdentifier:instanceId.longValue]; } - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId @@ -161,38 +136,30 @@ - (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanc error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration.uIView - withIdentifier:instanceId.longValue]; + [self.instanceManager addInstance:configuration.uIView withIdentifier:instanceId.longValue]; } - - (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)instanceId - - color:( nullable NSNumber *)color - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self uIView ForIdentifier:instanceId] setBackgroundColor + + color:(nullable NSNumber *)color + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self uIView ForIdentifier:instanceId] setBackgroundColor :color - - + ]; } - (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId - - opaque:( - nonnull NSNumber *)opaque - - error:(FlutterError *_Nullable *_Nonnull)error { - - [[self uIView ForIdentifier:instanceId] setOpaque + + opaque:(nonnull NSNumber *)opaque + + error:(FlutterError *_Nullable *_Nonnull)error { + [[self uIView ForIdentifier:instanceId] setOpaque :opaque - - + ]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m index dba7cfcae0b5..27aea6c57bd9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m @@ -16,34 +16,22 @@ @implementation FWFScrollViewHostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - UIScrollView - * scrollView - = ( - - - UIScrollView - *)[instanceManager instanceForIdentifier:0]; - - - XCTAssertTrue( - [scrollView isKindOfClass:[UIScrollView - class]]); - + + UIScrollView *scrollView = ( + + UIScrollView *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([scrollView isKindOfClass:[UIScrollView class]]); + XCTAssertNil(error); } - - (void)test GetContentOffset { - - - UIScrollView + UIScrollView *mockScrollView = OCMClassMock([ @@ -55,24 +43,20 @@ - (void)test GetContentOffset { [instanceManager addInstance:mockScrollView withIdentifier:0]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi contentOffsetForScrollViewWithIdentifier:@0 - - error:&error]; + + error:&error]; OCMVerify([mockScrollView getContentOffset - ]); XCTAssertNil(error); } - (void)test ScrollBy { - - - UIScrollView + UIScrollView *mockScrollView = OCMClassMock([ @@ -84,28 +68,24 @@ - (void)test ScrollBy { [instanceManager addInstance:mockScrollView withIdentifier:0]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi scrollByForScrollViewWithIdentifier:@0 - - offset:aValue - - error:&error]; + + offset:aValue + + error:&error]; OCMVerify([mockScrollView scrollBy :aValue - - + ]); XCTAssertNil(error); } - (void)test SetContentOffset { - - - UIScrollView + UIScrollView *mockScrollView = OCMClassMock([ @@ -117,20 +97,18 @@ - (void)test SetContentOffset { [instanceManager addInstance:mockScrollView withIdentifier:0]; FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setContentOffsetForScrollViewWithIdentifier:@0 - - offset:aValue - - error:&error]; + + offset:aValue + + error:&error]; OCMVerify([mockScrollView setContentOffset :aValue - - + ]); XCTAssertNil(error); } @@ -154,34 +132,22 @@ @implementation FWFUIViewHostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi createWithIdentifier:@0 error:&error]; - - - UIView - * uIView - = ( - - - UIView - *)[instanceManager instanceForIdentifier:0]; - - - XCTAssertTrue( - [uIView isKindOfClass:[UIView - class]]); - + + UIView *uIView = ( + + UIView *)[instanceManager instanceForIdentifier:0]; + + XCTAssertTrue([uIView isKindOfClass:[UIView class]]); + XCTAssertNil(error); } - - (void)test SetBackgroundColor { - - - UIView + UIView *mockUIView = OCMClassMock([ @@ -193,28 +159,24 @@ - (void)test SetBackgroundColor { [instanceManager addInstance:mockUIView withIdentifier:0]; FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setBackgroundColorForViewWithIdentifier:@0 - - color:aValue - - error:&error]; + + color:aValue + + error:&error]; OCMVerify([mockUIView setBackgroundColor :aValue - - + ]); XCTAssertNil(error); } - (void)test SetOpaque { - - - UIView + UIView *mockUIView = OCMClassMock([ @@ -226,20 +188,18 @@ - (void)test SetOpaque { [instanceManager addInstance:mockUIView withIdentifier:0]; FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] - initWithInstanceManager:instanceManager]; + [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; [hostApi setOpaqueForViewWithIdentifier:@0 - - opaque:aValue - - error:&error]; + + opaque:aValue + + error:&error]; OCMVerify([mockUIView setOpaque :aValue - - + ]); XCTAssertNil(error); } 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 1a62c9267001..0f1f56266f75 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 @@ -21,59 +21,75 @@ class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebsiteDataStoreHostApi { - static const MessageCodec codec = _TestWKWebsiteDataStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKWebsiteDataStoreHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); void createDefaultDataStore(int instanceId); - Future removeDataOfTypes(int instanceId, List dataTypes, double secondsModifiedSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes( + int instanceId, + List dataTypes, + double secondsModifiedSinceEpoch); + static void setup(TestWKWebsiteDataStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_instanceId!); return {}; }); @@ -81,20 +97,28 @@ abstract class TestWKWebsiteDataStoreHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = + (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); final double? arg_secondsModifiedSinceEpoch = (args[2] as double?); - assert(arg_secondsModifiedSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); + assert(arg_secondsModifiedSinceEpoch != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes( + arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); return {'result': output}; }); } @@ -105,23 +129,28 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } + abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); void setBackgroundColor(int instanceId, int? value); void setOpaque(int instanceId, bool opaque); - static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_instanceId!, arg_value); return {}; @@ -130,17 +159,21 @@ abstract class TestUIViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_instanceId!, arg_opaque!); return {}; }); @@ -152,6 +185,7 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } + abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -159,20 +193,25 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int instanceId); void scrollBy(int instanceId, double x, double y); void setContentOffset(int instanceId, double x, double y); - static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIScrollViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -180,15 +219,18 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_instanceId!); return {'result': output}; }); @@ -196,19 +238,24 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.scrollBy', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -216,19 +263,24 @@ abstract class TestUIScrollViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_instanceId!, arg_x!, arg_y!); return {}; }); @@ -244,42 +296,48 @@ class _TestWKWebViewConfigurationHostApiCodec extends StandardMessageCodec { if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebViewConfigurationHostApi { - static const MessageCodec codec = _TestWKWebViewConfigurationHostApiCodec(); + static const MessageCodec codec = + _TestWKWebViewConfigurationHostApiCodec(); void create(int instanceId); void createFromWebView(int instanceId, int webViewInstanceId); void setAllowsInlineMediaPlayback(int instanceId, bool allow); - void setMediaTypesRequiringUserActionForPlayback(int instanceId, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback( + int instanceId, List types); + static void setup(TestWKWebViewConfigurationHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -287,17 +345,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewInstanceId = (args[1] as int?); - assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_instanceId!, arg_webViewInstanceId!); return {}; }); @@ -305,17 +368,22 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_instanceId!, arg_allow!); return {}; }); @@ -323,18 +391,26 @@ abstract class TestWKWebViewConfigurationHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = (args[1] as List?)?.cast(); - assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback(arg_instanceId!, arg_types!); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = + (args[1] as List?) + ?.cast(); + assert(arg_types != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback( + arg_instanceId!, arg_types!); return {}; }); } @@ -349,91 +425,112 @@ class _TestWKUserContentControllerHostApiCodec extends StandardMessageCodec { if (value is WKUserScriptData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WKUserScriptData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKUserContentControllerHostApi { - static const MessageCodec codec = _TestWKUserContentControllerHostApiCodec(); + static const MessageCodec codec = + _TestWKUserContentControllerHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); - void addScriptMessageHandler(int instanceId, int handlerInstanceid, String name); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); + void addScriptMessageHandler( + int instanceId, int handlerInstanceid, String name); void removeScriptMessageHandler(int instanceId, String name); void removeAllScriptMessageHandlers(int instanceId); void addUserScript(int instanceId, WKUserScriptData userScript); void removeAllUserScripts(int instanceId); - static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUserContentControllerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerInstanceid = (args[1] as int?); - assert(arg_handlerInstanceid != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerInstanceid != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler(arg_instanceId!, arg_handlerInstanceid!, arg_name!); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler( + arg_instanceId!, arg_handlerInstanceid!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_instanceId!, arg_name!); return {}; }); @@ -441,15 +538,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_instanceId!); return {}; }); @@ -457,17 +558,23 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); - assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = + (args[1] as WKUserScriptData?); + assert(arg_userScript != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_instanceId!, arg_userScript!); return {}; }); @@ -475,15 +582,19 @@ abstract class TestWKUserContentControllerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_instanceId!); return {}; }); @@ -495,43 +606,56 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } + abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration(int instanceId, int configurationInstanceId); + void createFromWebViewConfiguration( + int instanceId, int configurationInstanceId); void setJavaScriptEnabled(int instanceId, bool enabled); - static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_instanceId!, arg_configurationInstanceId!); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_instanceId!, arg_configurationInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_instanceId!, arg_enabled!); return {}; }); @@ -543,22 +667,28 @@ abstract class TestWKPreferencesHostApi { class _TestWKScriptMessageHandlerHostApiCodec extends StandardMessageCodec { const _TestWKScriptMessageHandlerHostApiCodec(); } + abstract class TestWKScriptMessageHandlerHostApi { - static const MessageCodec codec = _TestWKScriptMessageHandlerHostApiCodec(); + static const MessageCodec codec = + _TestWKScriptMessageHandlerHostApiCodec(); void create(int instanceId); - static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -570,23 +700,29 @@ abstract class TestWKScriptMessageHandlerHostApi { class _TestWKNavigationDelegateHostApiCodec extends StandardMessageCodec { const _TestWKNavigationDelegateHostApiCodec(); } + abstract class TestWKNavigationDelegateHostApi { - static const MessageCodec codec = _TestWKNavigationDelegateHostApiCodec(); + static const MessageCodec codec = + _TestWKNavigationDelegateHostApiCodec(); void create(int instanceId); void setDidFinishNavigation(int instanceId, int? functionInstanceId); - static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -594,15 +730,19 @@ abstract class TestWKNavigationDelegateHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.setDidFinishNavigation was null, expected non-null int.'); final int? arg_functionInstanceId = (args[1] as int?); api.setDidFinishNavigation(arg_instanceId!, arg_functionInstanceId); return {}; @@ -619,41 +759,46 @@ class _TestNSObjectHostApiCodec extends StandardMessageCodec { if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestNSObjectHostApi { static const MessageCodec codec = _TestNSObjectHostApiCodec(); void dispose(int instanceId); - void addObserver(int instanceId, int observerInstanceId, String keyPath, List options); + void addObserver(int instanceId, int observerInstanceId, String keyPath, + List options); void removeObserver(int instanceId, int observerInstanceId, String keyPath); - static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_instanceId!); return {}; }); @@ -661,42 +806,57 @@ abstract class TestNSObjectHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = (args[3] as List?)?.cast(); - assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!, arg_options!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = + (args[3] as List?) + ?.cast(); + assert(arg_options != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_instanceId!, arg_observerInstanceId!, + arg_keyPath!, arg_options!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerInstanceId = (args[1] as int?); - assert(arg_observerInstanceId != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerInstanceId != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver(arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver( + arg_instanceId!, arg_observerInstanceId!, arg_keyPath!); return {}; }); } @@ -711,72 +871,65 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSUrlRequestData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return WKUserScriptData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -798,20 +951,25 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int instanceId, bool allow); void setCustomUserAgent(int instanceId, String? userAgent); Future evaluateJavaScript(int instanceId, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationInstanceId = (args[1] as int?); - assert(arg_configurationInstanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationInstanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!, arg_configurationInstanceId!); return {}; }); @@ -819,15 +977,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateInstanceId = (args[1] as int?); api.setUIDelegate(arg_instanceId!, arg_uiDelegateInstanceId); return {}; @@ -836,32 +997,39 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateInstanceId = (args[1] as int?); - api.setNavigationDelegate(arg_instanceId!, arg_navigationDelegateInstanceId); + api.setNavigationDelegate( + arg_instanceId!, arg_navigationDelegateInstanceId); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getUrl', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_instanceId!); return {'result': output}; }); @@ -869,15 +1037,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_instanceId!); return {'result': output}; }); @@ -885,17 +1056,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_instanceId!, arg_request!); return {}; }); @@ -903,17 +1078,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_instanceId!, arg_string!, arg_baseUrl); return {}; @@ -922,19 +1101,24 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_instanceId!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -942,17 +1126,21 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_instanceId!, arg_key!); return {}; }); @@ -960,15 +1148,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoBack', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_instanceId!); return {'result': output}; }); @@ -976,15 +1167,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.canGoForward', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_instanceId!); return {'result': output}; }); @@ -992,15 +1186,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goBack', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_instanceId!); return {}; }); @@ -1008,15 +1205,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.goForward', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_instanceId!); return {}; }); @@ -1024,15 +1224,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.reload', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_instanceId!); return {}; }); @@ -1040,15 +1243,18 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.getTitle', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_instanceId!); return {'result': output}; }); @@ -1056,33 +1262,42 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures(arg_instanceId!, arg_allow!); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures( + arg_instanceId!, arg_allow!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_instanceId!, arg_userAgent); return {}; @@ -1091,18 +1306,23 @@ abstract class TestWKWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript(arg_instanceId!, arg_javaScriptString!); + assert(arg_javaScriptString != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript( + arg_instanceId!, arg_javaScriptString!); return {'result': output}; }); } @@ -1113,22 +1333,27 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } + abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int instanceId); - static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_instanceId!); return {}; }); @@ -1144,67 +1369,79 @@ class _TestWKHttpCookieStoreHostApiCodec extends StandardMessageCodec { if (value is NSHttpCookieData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSHttpCookieData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKHttpCookieStoreHostApi { - static const MessageCodec codec = _TestWKHttpCookieStoreHostApiCodec(); + static const MessageCodec codec = + _TestWKHttpCookieStoreHostApiCodec(); - void createFromWebsiteDataStore(int instanceId, int websiteDataStoreInstanceId); + void createFromWebsiteDataStore( + int instanceId, int websiteDataStoreInstanceId); Future setCookie(int instanceId, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreInstanceId = (args[1] as int?); - assert(arg_websiteDataStoreInstanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore(arg_instanceId!, arg_websiteDataStoreInstanceId!); + assert(arg_websiteDataStoreInstanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore( + arg_instanceId!, arg_websiteDataStoreInstanceId!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMockMessageHandler(null); } else { channel.setMockMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); - assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_instanceId!, arg_cookie!); return {}; }); From 8f0ba5bd0a4547be8412cd4787c9e79768ad94de Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:25:18 -0700 Subject: [PATCH 14/23] small spaces --- .../example/ios/RunnerTests/FWFObjectHostApiTests.m | 1 - .../webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m index 831654d0b421..6886c2600e13 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -79,5 +79,4 @@ - (void)testDispose { XCTAssertEqual([instanceManager identifierForInstance:object], NSNotFound); XCTAssertNil(error); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index 000e9e9f34ad..7f94977fb3b5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -51,5 +51,4 @@ - (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { [self.instanceManager removeInstance:[self objectForIdentifier:instanceId]]; } - @end From fc6a356e5b61278e56e91918774f1691115be96c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:29:05 -0700 Subject: [PATCH 15/23] delete generated files --- .../webview_flutter_wkwebview/go.sh | 13 - .../src/foundation/foundation.simple_ast.json | 731 --------- .../lib/src/foundation/output.h | 23 - .../lib/src/foundation/output.m | 100 -- .../lib/src/foundation/output_test.m | 128 -- .../lib/src/ui_kit/output.h | 46 - .../lib/src/ui_kit/output.m | 166 -- .../lib/src/ui_kit/output_test.m | 207 --- .../lib/src/ui_kit/ui_kit.simple_ast.json | 432 ----- .../lib/src/web_kit/data_output.h | 45 - .../lib/src/web_kit/data_output.m | 107 -- .../lib/src/web_kit/output.h | 202 --- .../lib/src/web_kit/output.m | 573 ------- .../lib/src/web_kit/output_test.m | 566 ------- .../lib/src/web_kit/web_kit.simple_ast.json | 1455 ----------------- .../webview_flutter_wkwebview/pubspec.yaml | 6 - 16 files changed, 4800 deletions(-) delete mode 100755 packages/webview_flutter/webview_flutter_wkwebview/go.sh delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json diff --git a/packages/webview_flutter/webview_flutter_wkwebview/go.sh b/packages/webview_flutter/webview_flutter_wkwebview/go.sh deleted file mode 100755 index 238b4a1e7b29..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/go.sh +++ /dev/null @@ -1,13 +0,0 @@ -#flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/web_kit/web_kit.simple_ast.json --token-opener /*- lib/src/web_kit/output.h -#flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output.m -#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m -#flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/web_kit/data_output.h -#flutter pub run code_template_processor --template-file lib/src/web_kit/data_template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/web_kit/data_output.m -#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/web_kit/web_kit.simple_ast.json lib/src/web_kit/output_test.m -#flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/ui_kit/ui_kit.simple_ast.json --token-opener /*- lib/src/ui_kit/output.h -#flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output.m -#flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/ui_kit/ui_kit.simple_ast.json lib/src/ui_kit/output_test.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template.h --data-file lib/src/foundation/foundation.simple_ast.json --token-opener /*- lib/src/foundation/output.h -flutter pub run code_template_processor --template-file lib/src/web_kit/template.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/foundation/output.m -flutter pub run code_template_processor --template-file lib/src/web_kit/template_test.m --data-file lib/src/foundation/foundation.simple_ast.json lib/src/foundation/output_test.m - diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json deleted file mode 100644 index 6182f7865431..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.simple_ast.json +++ /dev/null @@ -1,731 +0,0 @@ -{ - "classes": [ - { - "name": "NSObject", - "methods": [ - { - "name": "addObserver", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "observer", - "type": { - "name": "NSObject", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSObject" - } - }, - "customValues": {} - }, - { - "name": "keyPath", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSString" - } - }, - "customValues": {} - }, - { - "name": "options", - "type": { - "name": "Set", - "nullable": false, - "typeArguments": [ - { - "name": "NSKeyValueObservingOptions", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSArray" - } - }, - "customValues": {} - } - ], - "customValues": { - "returnsVoid": true, - "objcName": "addObserverForObjectWithIdentifier" - } - }, - { - "name": "removeObserver", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "observer", - "type": { - "name": "NSObject", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSObject" - } - }, - "customValues": {} - }, - { - "name": "keyPath", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSString" - } - }, - "customValues": {} - } - ], - "customValues": { - "returnsVoid": true, - "objcName": "removeObserverForObjectWithIdentifier" - } - }, - { - "name": "dispose", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [], - "customValues": { - "returnsVoid": true, - "objcName": "disposeObjectWithIdentifier" - } - } - ], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "Object" - } - } - ], - "functions": [], - "enums": [ - { - "name": "NSKeyValueObservingOptions", - "values": [ - { - "name": "newValue", - "type": { - "name": "NSKeyValueObservingOptions", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "oldValue", - "type": { - "name": "NSKeyValueObservingOptions", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "initialValue", - "type": { - "name": "NSKeyValueObservingOptions", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "priorNotification", - "type": { - "name": "NSKeyValueObservingOptions", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - }, - { - "name": "NSKeyValueChange", - "values": [ - { - "name": "setting", - "type": { - "name": "NSKeyValueChange", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "insertion", - "type": { - "name": "NSKeyValueChange", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "removal", - "type": { - "name": "NSKeyValueChange", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "replacement", - "type": { - "name": "NSKeyValueChange", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - }, - { - "name": "NSKeyValueChangeKey", - "values": [ - { - "name": "indexes", - "type": { - "name": "NSKeyValueChangeKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "kind", - "type": { - "name": "NSKeyValueChangeKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "newValue", - "type": { - "name": "NSKeyValueChangeKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "notificationIsPrior", - "type": { - "name": "NSKeyValueChangeKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "oldValue", - "type": { - "name": "NSKeyValueChangeKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - }, - { - "name": "NSHttpCookiePropertyKey", - "values": [ - { - "name": "comment", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "commentUrl", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "discard", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "domain", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "expires", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "maximumAge", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "name", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "originUrl", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "path", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "port", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "sameSitePolicy", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "secure", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "value", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "version", - "type": { - "name": "NSHttpCookiePropertyKey", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h deleted file mode 100644 index 000ca7280099..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.h +++ /dev/null @@ -1,23 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for NSObject. - * - * Handles creating NSObject that intercommunicate with a paired Dart object. - */ -@interface FWFObjectHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m deleted file mode 100644 index b7795c2e444f..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output.m +++ /dev/null @@ -1,100 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFObjectHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFObjectHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFObjectHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - NSObject - - *)object -ForIdentifier:(NSNumber *)instanceId { - return ( - - NSObject - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - NSObject - - *object = - - [[NSObject alloc] init]; - - [self.instanceManager addInstance:object withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.object withIdentifier:instanceId.longValue]; -} - -- (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - - observer:(nonnull NSObject *)observer - - keyPath:(nonnull NSString *)keyPath - - options:(nonnull NSArray *) - options - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self object ForIdentifier:instanceId] addObserver - - :observer - - keyPath:keyPath - - options:options - - ]; -} - -- (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - - observer:(nonnull NSObject *)observer - - keyPath:(nonnull NSString *)keyPath - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self object ForIdentifier:instanceId] removeObserver - - :observer - - keyPath:keyPath - - ]; -} - -- (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self object ForIdentifier:instanceId] dispose - - ]; -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m deleted file mode 100644 index bd95e5447e59..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/output_test.m +++ /dev/null @@ -1,128 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFObjectHostApiTests : XCTestCase -@end - -@implementation FWFObjectHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - NSObject *object = ( - - NSObject *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([object isKindOfClass:[NSObject class]]); - - XCTAssertNil(error); -} - -- (void)test AddObserver { - NSObject - *mockObject = OCMClassMock([ - - - NSObject - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockObject withIdentifier:0]; - - FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi addObserverForObjectWithIdentifier:@0 - - observer:aValue - - keyPath:aValue - - options:aValue - - error:&error]; - OCMVerify([mockObject addObserver - - :aValue - - keyPath:aValue - - options:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test RemoveObserver { - NSObject - *mockObject = OCMClassMock([ - - - NSObject - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockObject withIdentifier:0]; - - FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi removeObserverForObjectWithIdentifier:@0 - - observer:aValue - - keyPath:aValue - - error:&error]; - OCMVerify([mockObject removeObserver - - :aValue - - keyPath:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test Dispose { - NSObject - *mockObject = OCMClassMock([ - - - NSObject - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockObject withIdentifier:0]; - - FWFObjectHostApiImpl *hostApi = - [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi disposeObjectWithIdentifier:@0 - - error:&error]; - OCMVerify([mockObject dispose - - ]); - XCTAssertNil(error); -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h deleted file mode 100644 index 7010adbb5797..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.h +++ /dev/null @@ -1,46 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for UIScrollView. - * - * Handles creating UIScrollView that intercommunicate with a paired Dart object. - */ -@interface FWFScrollViewHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for UIView. - * - * Handles creating UIView that intercommunicate with a paired Dart object. - */ -@interface FWFUIViewHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m deleted file mode 100644 index 97870e7f46d9..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output.m +++ /dev/null @@ -1,166 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFScrollViewHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFScrollViewHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFScrollViewHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - UIScrollView - - *)scrollView -ForIdentifier:(NSNumber *)instanceId { - return ( - - UIScrollView - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - UIScrollView - - *scrollView = - - [[UIScrollView alloc] init]; - - [self.instanceManager addInstance:scrollView withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.scrollView withIdentifier:instanceId.longValue]; -} - -- (void)contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - return [[self scrollView ForIdentifier:instanceId] getContentOffset - - ]; -} - -- (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - offset:(nonnull NSNumber *)offset - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self scrollView ForIdentifier:instanceId] scrollBy - -:offset - - ]; -} - -- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instanceId - - offset:(nonnull NSNumber *)offset - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self scrollView ForIdentifier:instanceId] setContentOffset - -:offset - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFUIViewHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFUIViewHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFUIViewHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - UIView - - *)uIView -ForIdentifier:(NSNumber *)instanceId { - return ( - - UIView - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - UIView - - *uIView = - - [[UIView alloc] init]; - - [self.instanceManager addInstance:uIView withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.uIView withIdentifier:instanceId.longValue]; -} - -- (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)instanceId - - color:(nullable NSNumber *)color - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self uIView ForIdentifier:instanceId] setBackgroundColor - -:color - - ]; -} - -- (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId - - opaque:(nonnull NSNumber *)opaque - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self uIView ForIdentifier:instanceId] setOpaque - -:opaque - - ]; -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m deleted file mode 100644 index 27aea6c57bd9..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/output_test.m +++ /dev/null @@ -1,207 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFScrollViewHostApiTests : XCTestCase -@end - -@implementation FWFScrollViewHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - UIScrollView *scrollView = ( - - UIScrollView *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([scrollView isKindOfClass:[UIScrollView class]]); - - XCTAssertNil(error); -} - -- (void)test GetContentOffset { - UIScrollView - *mockScrollView = OCMClassMock([ - - - UIScrollView - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockScrollView withIdentifier:0]; - - FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi contentOffsetForScrollViewWithIdentifier:@0 - - error:&error]; - OCMVerify([mockScrollView getContentOffset - - ]); - XCTAssertNil(error); -} - -- (void)test ScrollBy { - UIScrollView - *mockScrollView = OCMClassMock([ - - - UIScrollView - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockScrollView withIdentifier:0]; - - FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi scrollByForScrollViewWithIdentifier:@0 - - offset:aValue - - error:&error]; - OCMVerify([mockScrollView scrollBy - -:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test SetContentOffset { - UIScrollView - *mockScrollView = OCMClassMock([ - - - UIScrollView - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockScrollView withIdentifier:0]; - - FWFScrollViewHostApiImpl *hostApi = - [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setContentOffsetForScrollViewWithIdentifier:@0 - - offset:aValue - - error:&error]; - OCMVerify([mockScrollView setContentOffset - -:aValue - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFUIViewHostApiTests : XCTestCase -@end - -@implementation FWFUIViewHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - UIView *uIView = ( - - UIView *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([uIView isKindOfClass:[UIView class]]); - - XCTAssertNil(error); -} - -- (void)test SetBackgroundColor { - UIView - *mockUIView = OCMClassMock([ - - - UIView - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUIView withIdentifier:0]; - - FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setBackgroundColorForViewWithIdentifier:@0 - - color:aValue - - error:&error]; - OCMVerify([mockUIView setBackgroundColor - -:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test SetOpaque { - UIView - *mockUIView = OCMClassMock([ - - - UIView - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUIView withIdentifier:0]; - - FWFUIViewHostApiImpl *hostApi = - [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setOpaqueForViewWithIdentifier:@0 - - opaque:aValue - - error:&error]; - OCMVerify([mockUIView setOpaque - -:aValue - - ]); - XCTAssertNil(error); -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json deleted file mode 100644 index e1cbf5d187d5..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.simple_ast.json +++ /dev/null @@ -1,432 +0,0 @@ -{ - "classes": [ - { - "name": "UIScrollView", - "methods": [ - { - "name": "getContentOffset", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "Point", - "nullable": false, - "typeArguments": [ - { - "name": "double", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "returnsVoid": false, - "static": false, - "parameters": [], - "customValues": { - "objcName": "contentOffsetForScrollViewWithIdentifier", - "returnsVoid": false - } - }, - { - "name": "scrollBy", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "offset", - "type": { - "name": "Point", - "nullable": false, - "typeArguments": [ - { - "name": "double", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "scrollByForScrollViewWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "setContentOffset", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "offset", - "type": { - "name": "Point", - "nullable": false, - "typeArguments": [ - { - "name": "double", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setContentOffsetForScrollViewWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "fromWebView", - "parameters": [ - { - "name": "webView", - "type": { - "name": "WKWebView", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "ScrollView" - } - }, - { - "name": "UIView", - "methods": [ - { - "name": "setBackgroundColor", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "color", - "type": { - "name": "Color", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setBackgroundColorForViewWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "setOpaque", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "opaque", - "type": { - "name": "bool", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setOpaqueForViewWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "UIView" - } - } - ], - "functions": [], - "enums": [] -} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h deleted file mode 100644 index 482c791d66d4..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.h +++ /dev/null @@ -1,45 +0,0 @@ - -/** - * Converts an FWFNSKeyValueObservingOptionsEnumData to an - * NSKeyValueObservingOptions. - * - * @param data The data object containing information to create an - * NSKeyValueObservingOptions. - * - * @return An NSKeyValueObservingOptions or -1 if data could not be converted. - */ -extern NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( - FWFNSKeyValueObservingOptionsEnumData* data); - -/** - * Converts an FWFNSKeyValueChangeEnumData to an NSKeyValueChange. - * - * @param data The data object containing information to create an - * NSKeyValueChange. - * - * @return An NSKeyValueChange or -1 if data could not be converted. - */ -extern NSKeyValueChange FWFNSKeyValueChangeFromEnumData( - FWFNSKeyValueChangeEnumData* data); - -/** - * Converts an FWFNSKeyValueChangeKeyEnumData to an NSKeyValueChangeKey. - * - * @param data The data object containing information to create an - * NSKeyValueChangeKey. - * - * @return An NSKeyValueChangeKey or -1 if data could not be converted. - */ -extern NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData( - FWFNSKeyValueChangeKeyEnumData* data); - -/** - * Converts an FWFNSHttpCookiePropertyKeyEnumData to an NSHttpCookiePropertyKey. - * - * @param data The data object containing information to create an - * NSHttpCookiePropertyKey. - * - * @return An NSHttpCookiePropertyKey or -1 if data could not be converted. - */ -extern NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( - FWFNSHttpCookiePropertyKeyEnumData* data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m deleted file mode 100644 index 4f8730819731..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_output.m +++ /dev/null @@ -1,107 +0,0 @@ - -NSKeyValueObservingOptions FWFNSKeyValueObservingOptionsFromEnumData( - FWFNSKeyValueObservingOptionsEnumData *data) { - switch (data.value) { - case FWFNSKeyValueObservingOptionsEnum NewValue: - return NSKeyValueObservingOptions NewValue; - - case FWFNSKeyValueObservingOptionsEnum OldValue: - return NSKeyValueObservingOptions OldValue; - - case FWFNSKeyValueObservingOptionsEnum InitialValue: - return NSKeyValueObservingOptions InitialValue; - - case FWFNSKeyValueObservingOptionsEnum PriorNotification: - return NSKeyValueObservingOptions PriorNotification; - } - - return -1; -} - -NSKeyValueChange FWFNSKeyValueChangeFromEnumData(FWFNSKeyValueChangeEnumData *data) { - switch (data.value) { - case FWFNSKeyValueChangeEnum Setting: - return NSKeyValueChange Setting; - - case FWFNSKeyValueChangeEnum Insertion: - return NSKeyValueChange Insertion; - - case FWFNSKeyValueChangeEnum Removal: - return NSKeyValueChange Removal; - - case FWFNSKeyValueChangeEnum Replacement: - return NSKeyValueChange Replacement; - } - - return -1; -} - -NSKeyValueChangeKey FWFNSKeyValueChangeKeyFromEnumData(FWFNSKeyValueChangeKeyEnumData *data) { - switch (data.value) { - case FWFNSKeyValueChangeKeyEnum Indexes: - return NSKeyValueChangeKey Indexes; - - case FWFNSKeyValueChangeKeyEnum Kind: - return NSKeyValueChangeKey Kind; - - case FWFNSKeyValueChangeKeyEnum NewValue: - return NSKeyValueChangeKey NewValue; - - case FWFNSKeyValueChangeKeyEnum NotificationIsPrior: - return NSKeyValueChangeKey NotificationIsPrior; - - case FWFNSKeyValueChangeKeyEnum OldValue: - return NSKeyValueChangeKey OldValue; - } - - return -1; -} - -NSHttpCookiePropertyKey FWFNSHttpCookiePropertyKeyFromEnumData( - FWFNSHttpCookiePropertyKeyEnumData *data) { - switch (data.value) { - case FWFNSHttpCookiePropertyKeyEnum Comment: - return NSHttpCookiePropertyKey Comment; - - case FWFNSHttpCookiePropertyKeyEnum CommentUrl: - return NSHttpCookiePropertyKey CommentUrl; - - case FWFNSHttpCookiePropertyKeyEnum Discard: - return NSHttpCookiePropertyKey Discard; - - case FWFNSHttpCookiePropertyKeyEnum Domain: - return NSHttpCookiePropertyKey Domain; - - case FWFNSHttpCookiePropertyKeyEnum Expires: - return NSHttpCookiePropertyKey Expires; - - case FWFNSHttpCookiePropertyKeyEnum MaximumAge: - return NSHttpCookiePropertyKey MaximumAge; - - case FWFNSHttpCookiePropertyKeyEnum Name: - return NSHttpCookiePropertyKey Name; - - case FWFNSHttpCookiePropertyKeyEnum OriginUrl: - return NSHttpCookiePropertyKey OriginUrl; - - case FWFNSHttpCookiePropertyKeyEnum Path: - return NSHttpCookiePropertyKey Path; - - case FWFNSHttpCookiePropertyKeyEnum Port: - return NSHttpCookiePropertyKey Port; - - case FWFNSHttpCookiePropertyKeyEnum SameSitePolicy: - return NSHttpCookiePropertyKey SameSitePolicy; - - case FWFNSHttpCookiePropertyKeyEnum Secure: - return NSHttpCookiePropertyKey Secure; - - case FWFNSHttpCookiePropertyKeyEnum Value: - return NSHttpCookiePropertyKey Value; - - case FWFNSHttpCookiePropertyKeyEnum Version: - return NSHttpCookiePropertyKey Version; - } - - return -1; -} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h deleted file mode 100644 index 724a5b1263d0..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.h +++ /dev/null @@ -1,202 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for WKPreferences. - * - * Handles creating WKPreferences that intercommunicate with a paired Dart object. - */ -@interface FWFPreferencesHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for WKWebsiteDataStore. - * - * Handles creating WKWebsiteDataStore that intercommunicate with a paired Dart object. - */ -@interface FWFWebsiteDataStoreHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for WKHttpCookieStore. - * - * Handles creating WKHttpCookieStore that intercommunicate with a paired Dart object. - */ -@interface FWFHttpCookieStoreHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Implementation of WKScriptMessageHandler for FWFScriptMessageHandlerHostApiImpl. - */ -@interface FWFScriptMessageHandler : NSObject -@end - -/** - * Host api implementation for WKScriptMessageHandler. - * - * Handles creating WKScriptMessageHandler that intercommunicate with a paired Dart object. - */ -@interface FWFScriptMessageHandlerHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for WKUserContentController. - * - * Handles creating WKUserContentController that intercommunicate with a paired Dart object. - */ -@interface FWFUserContentControllerHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Host api implementation for WKWebViewConfiguration. - * - * Handles creating WKWebViewConfiguration that intercommunicate with a paired Dart object. - */ -@interface FWFWebViewConfigurationHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Implementation of WKUIDelegate for FWFUIDelegateHostApiImpl. - */ -@interface FWFUIDelegate : NSObject -@end - -/** - * Host api implementation for WKUIDelegate. - * - * Handles creating WKUIDelegate that intercommunicate with a paired Dart object. - */ -@interface FWFUIDelegateHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Implementation of WKNavigationDelegate for FWFNavigationDelegateHostApiImpl. - */ -@interface FWFNavigationDelegate : NSObject -@end - -/** - * Host api implementation for WKNavigationDelegate. - * - * Handles creating WKNavigationDelegate that intercommunicate with a paired Dart object. - */ -@interface FWFNavigationDelegateHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m deleted file mode 100644 index 395d1e073b17..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output.m +++ /dev/null @@ -1,573 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFPreferencesHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFPreferencesHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFPreferencesHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - WKPreferences - - *)preferencesForIdentifier:(NSNumber *)instanceId { - return ( - - WKPreferences - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKPreferences - - *preferences = - - [[WKPreferences alloc] init]; - - [self.instanceManager addInstance:preferences withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.preferences withIdentifier:instanceId.longValue]; -} - -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)instanceId - - enabled:(nonnull NSNumber *)enabled - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self preferences ForIdentifier:instanceId] setJavaScriptEnabled - -:enabled - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" -#import "FWFWebsiteDataStoreHostApi.h" - -@interface FWFWebsiteDataStoreHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFWebsiteDataStoreHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - WKWebsiteDataStore - - *)websiteDataStoreForIdentifier:(NSNumber *)instanceId { - return ( - - WKWebsiteDataStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebsiteDataStore - - *websiteDataStore = - - [[WKWebsiteDataStore alloc] init]; - - [self.instanceManager addInstance:websiteDataStore withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.websiteDataStore - withIdentifier:instanceId.longValue]; -} - -- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - - dataTypes: - (nonnull NSArray *)dataTypes - - since:(nonnull NSNumber *)since - - error:(FlutterError *_Nullable *_Nonnull)error { - return [[self websiteDataStore ForIdentifier:instanceId] removeDataOfTypes - - :dataTypes - - since:since - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFHttpCookieStoreHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFHttpCookieStoreHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFHttpCookieStoreHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - WKHttpCookieStore - - *)httpCookieStoreForIdentifier:(NSNumber *)instanceId { - return ( - - WKHttpCookieStore - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKHttpCookieStore - - *httpCookieStore = - - [[WKHttpCookieStore alloc] init]; - - [self.instanceManager addInstance:httpCookieStore withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.httpCookieStore - withIdentifier:instanceId.longValue]; -} - -- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)instanceId - - cookie:(nonnull NSHttpCookie *)cookie - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self httpCookieStore ForIdentifier:instanceId] setCookie - -:cookie - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFScriptMessageHandlerHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@implementation FWFScriptMessageHandler -@end - -@interface FWFScriptMessageHandlerHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFScriptMessageHandlerHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- (FWFScriptMessageHandler - - *)scriptMessageHandlerForIdentifier:(NSNumber *)instanceId { - return ( - - FWFScriptMessageHandler - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - FWFScriptMessageHandler - - *scriptMessageHandler = - - [[FWFScriptMessageHandler alloc] init]; - - [self.instanceManager addInstance:scriptMessageHandler withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.scriptMessageHandler - withIdentifier:instanceId.longValue]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFUserContentControllerHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFUserContentControllerHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFUserContentControllerHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - WKUserContentController - - *)userContentControllerForIdentifier:(NSNumber *)instanceId { - return ( - - WKUserContentController - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKUserContentController - - *userContentController = - - [[WKUserContentController alloc] init]; - - [self.instanceManager addInstance:userContentController withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.userContentController - withIdentifier:instanceId.longValue]; -} - -- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - handler:(nonnull WKScriptMessageHandler *)handler - - name:(nonnull NSString *)name - - error: - (FlutterError *_Nullable *_Nonnull)error { - [[self userContentController ForIdentifier:instanceId] addScriptMessageHandler - - :handler - - name:name - - ]; -} - -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - name:(nonnull NSString *)name - - error:(FlutterError *_Nullable *_Nonnull) - error { - [[self userContentController ForIdentifier:instanceId] removeScriptMessageHandler - -:name - - ]; -} - -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self userContentController ForIdentifier:instanceId] removeAllScriptMessageHandlers - - ]; -} - -- (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - userScript:(nonnull WKUserScript *)userScript - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self userContentController ForIdentifier:instanceId] addUserScript - -:userScript - - ]; -} - -- (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)instanceId - - error:(FlutterError *_Nullable *_Nonnull)error { - [[self userContentController ForIdentifier:instanceId] removeAllUserScripts - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" - -@interface FWFWebViewConfigurationHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFWebViewConfigurationHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- ( - - WKWebViewConfiguration - - *)webViewConfigurationForIdentifier:(NSNumber *)instanceId { - return ( - - WKWebViewConfiguration - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration - - *webViewConfiguration = - - [[WKWebViewConfiguration alloc] init]; - - [self.instanceManager addInstance:webViewConfiguration withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.webViewConfiguration - withIdentifier:instanceId.longValue]; -} - -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - allow:(nonnull NSNumber *)allow - - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self webViewConfiguration ForIdentifier:instanceId] setAllowsInlineMediaPlayback - -:allow - - ]; -} - -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - - types: - (nonnull NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - - error: - (FlutterError *_Nullable *_Nonnull) - error { - [[self webViewConfiguration ForIdentifier:instanceId] setMediaTypesRequiringUserActionForPlayback - -:types - - ]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFUIDelegateHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@implementation FWFUIDelegate -@end - -@interface FWFUIDelegateHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFUIDelegateHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- (FWFUIDelegate - - *)uIDelegateForIdentifier:(NSNumber *)instanceId { - return ( - - FWFUIDelegate - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - FWFUIDelegate - - *uIDelegate = - - [[FWFUIDelegate alloc] init]; - - [self.instanceManager addInstance:uIDelegate withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.uIDelegate withIdentifier:instanceId.longValue]; -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFNavigationDelegateHostApi.h" -#import "FWFWebViewConfigurationHostApi.h" - -@implementation FWFNavigationDelegate -@end - -@interface FWFNavigationDelegateHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWFNavigationDelegateHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- (FWFNavigationDelegate - - *)navigationDelegateForIdentifier:(NSNumber *)instanceId { - return ( - - FWFNavigationDelegate - - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - FWFNavigationDelegate - - *navigationDelegate = - - [[FWFNavigationDelegate alloc] init]; - - [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager addInstance:configuration.navigationDelegate - withIdentifier:instanceId.longValue]; -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m deleted file mode 100644 index d974bff6fbe2..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/output_test.m +++ /dev/null @@ -1,566 +0,0 @@ - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFPreferencesHostApiTests : XCTestCase -@end - -@implementation FWFPreferencesHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFPreferencesHostApiImpl *hostApi = - [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - WKPreferences *preferences = ( - - WKPreferences *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); - - XCTAssertNil(error); -} - -- (void)test SetJavaScriptEnabled { - WKPreferences - *mockPreferences = OCMClassMock([ - - - WKPreferences - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockPreferences withIdentifier:0]; - - FWFPreferencesHostApiImpl *hostApi = - [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 - - enabled:aValue - - error:&error]; - OCMVerify([mockPreferences setJavaScriptEnabled - -:aValue - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFWebsiteDataStoreHostApiTests : XCTestCase -@end - -@implementation FWFWebsiteDataStoreHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFWebsiteDataStoreHostApiImpl *hostApi = - [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - WKWebsiteDataStore *websiteDataStore = ( - - WKWebsiteDataStore *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([websiteDataStore isKindOfClass:[WKWebsiteDataStore class]]); - - XCTAssertNil(error); -} - -- (void)test RemoveDataOfTypes { - WKWebsiteDataStore - *mockWebsiteDataStore = OCMClassMock([ - - - WKWebsiteDataStore - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockWebsiteDataStore withIdentifier:0]; - - FWFWebsiteDataStoreHostApiImpl *hostApi = - [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi removeDataFromDataStoreWithIdentifier:@0 - - dataTypes:aValue - - since:aValue - - error:&error]; - OCMVerify([mockWebsiteDataStore removeDataOfTypes - - :aValue - - since:aValue - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFHttpCookieStoreHostApiTests : XCTestCase -@end - -@implementation FWFHttpCookieStoreHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFHttpCookieStoreHostApiImpl *hostApi = - [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - WKHttpCookieStore *httpCookieStore = ( - - WKHttpCookieStore *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([httpCookieStore isKindOfClass:[WKHttpCookieStore class]]); - - XCTAssertNil(error); -} - -- (void)test SetCookie { - WKHttpCookieStore - *mockHttpCookieStore = OCMClassMock([ - - - WKHttpCookieStore - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockHttpCookieStore withIdentifier:0]; - - FWFHttpCookieStoreHostApiImpl *hostApi = - [[FWFHttpCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setCookieForStoreWithIdentifier:@0 - - cookie:aValue - - error:&error]; - OCMVerify([mockHttpCookieStore setCookie - -:aValue - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFScriptMessageHandlerHostApiTests : XCTestCase -@end - -@implementation FWFScriptMessageHandlerHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFScriptMessageHandlerHostApiImpl *hostApi = - [[FWFScriptMessageHandlerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - FWFScriptMessageHandler - - *scriptMessageHandler = ( - - FWFScriptMessageHandler - - *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([scriptMessageHandler conformsToProtocol:@protocol(WKScriptMessageHandler)]); - - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFUserContentControllerHostApiTests : XCTestCase -@end - -@implementation FWFUserContentControllerHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - WKUserContentController *userContentController = ( - - WKUserContentController *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); - - XCTAssertNil(error); -} - -- (void)test AddScriptMessageHandler { - WKUserContentController - *mockUserContentController = OCMClassMock([ - - - WKUserContentController - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUserContentController withIdentifier:0]; - - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi addScriptMessageHandlerForControllerWithIdentifier:@0 - - handler:aValue - - name:aValue - - error:&error]; - OCMVerify([mockUserContentController addScriptMessageHandler - - :aValue - - name:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test RemoveScriptMessageHandler { - WKUserContentController - *mockUserContentController = OCMClassMock([ - - - WKUserContentController - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUserContentController withIdentifier:0]; - - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi removeScriptMessageHandlerForControllerWithIdentifier:@0 - - name:aValue - - error:&error]; - OCMVerify([mockUserContentController removeScriptMessageHandler - -:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test RemoveAllScriptMessageHandlers { - WKUserContentController - *mockUserContentController = OCMClassMock([ - - - WKUserContentController - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUserContentController withIdentifier:0]; - - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - - error:&error]; - OCMVerify([mockUserContentController removeAllScriptMessageHandlers - - ]); - XCTAssertNil(error); -} - -- (void)test AddUserScript { - WKUserContentController - *mockUserContentController = OCMClassMock([ - - - WKUserContentController - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUserContentController withIdentifier:0]; - - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi addUserScriptForControllerWithIdentifier:@0 - - userScript:aValue - - error:&error]; - OCMVerify([mockUserContentController addUserScript - -:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test RemoveAllUserScripts { - WKUserContentController - *mockUserContentController = OCMClassMock([ - - - WKUserContentController - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockUserContentController withIdentifier:0]; - - FWFUserContentControllerHostApiImpl *hostApi = - [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - - error:&error]; - OCMVerify([mockUserContentController removeAllUserScripts - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFWebViewConfigurationHostApiTests : XCTestCase -@end - -@implementation FWFWebViewConfigurationHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - WKWebViewConfiguration *webViewConfiguration = ( - - WKWebViewConfiguration *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([webViewConfiguration isKindOfClass:[WKWebViewConfiguration class]]); - - XCTAssertNil(error); -} - -- (void)test SetAllowsInlineMediaPlayback { - WKWebViewConfiguration - *mockWebViewConfiguration = OCMClassMock([ - - - WKWebViewConfiguration - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; - - FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - - allow:aValue - - error:&error]; - OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback - -:aValue - - ]); - XCTAssertNil(error); -} - -- (void)test SetMediaTypesRequiringUserActionForPlayback { - WKWebViewConfiguration - *mockWebViewConfiguration = OCMClassMock([ - - - WKWebViewConfiguration - - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mockWebViewConfiguration withIdentifier:0]; - - FWFWebViewConfigurationHostApiImpl *hostApi = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 - - types:aValue - - error:&error]; - OCMVerify([mockWebViewConfiguration setMediaTypesRequiringUserActionForPlayback - -:aValue - - ]); - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFUIDelegateHostApiTests : XCTestCase -@end - -@implementation FWFUIDelegateHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFUIDelegateHostApiImpl *hostApi = - [[FWFUIDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - FWFUIDelegate - - *uIDelegate = ( - - FWFUIDelegate - - *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([uIDelegate conformsToProtocol:@protocol(WKUIDelegate)]); - - XCTAssertNil(error); -} - -@end - -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWFNavigationDelegateHostApiTests : XCTestCase -@end - -@implementation FWFNavigationDelegateHostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFNavigationDelegateHostApiImpl *hostApi = - [[FWFNavigationDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - - FWFNavigationDelegate - - *navigationDelegate = ( - - FWFNavigationDelegate - - *)[instanceManager instanceForIdentifier:0]; - - XCTAssertTrue([navigationDelegate conformsToProtocol:@protocol(WKNavigationDelegate)]); - - XCTAssertNil(error); -} - -@end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json deleted file mode 100644 index ee4eb5e27379..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.simple_ast.json +++ /dev/null @@ -1,1455 +0,0 @@ -{ - "classes": [ - { - "name": "WKPreferences", - "methods": [ - { - "name": "setJavaScriptEnabled", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "enabled", - "type": { - "name": "bool", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setJavaScriptEnabledForPreferencesWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "fromWebViewConfiguration", - "parameters": [ - { - "name": "configuration", - "type": { - "name": "WKWebViewConfiguration", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "Preferences", - "isProtocol": false - } - }, - { - "name": "WKWebsiteDataStore", - "methods": [ - { - "name": "removeDataOfTypes", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "bool", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "dataTypes", - "type": { - "name": "Set", - "nullable": false, - "typeArguments": [ - { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSArray" - } - }, - "customValues": {} - }, - { - "name": "since", - "type": { - "name": "DateTime", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "removeDataFromDataStoreWithIdentifier", - "returnsVoid": false - } - } - ], - "constructors": [ - { - "name": "fromWebViewConfiguration", - "parameters": [ - { - "name": "configuration", - "type": { - "name": "WKWebViewConfiguration", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [ - { - "name": "defaultDataStore", - "type": { - "name": "WKWebsiteDataStore", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "httpCookieStore", - "type": { - "name": "WKHttpCookieStore", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ], - "customValues": { - "nameWithoutPrefix": "WebsiteDataStore", - "isProtocol": false - } - }, - { - "name": "WKHttpCookieStore", - "methods": [ - { - "name": "setCookie", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "cookie", - "type": { - "name": "NSHttpCookie", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSHttpCookie" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setCookieForStoreWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "fromWebsiteDataStore", - "parameters": [ - { - "name": "dataStore", - "type": { - "name": "WKWebsiteDataStore", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "HttpCookieStore", - "isProtocol": false - } - }, - { - "name": "WKScriptMessageHandler", - "methods": [], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "ScriptMessageHandler", - "isProtocol": true - } - }, - { - "name": "WKUserContentController", - "methods": [ - { - "name": "addScriptMessageHandler", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "handler", - "type": { - "name": "WKScriptMessageHandler", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "WKScriptMessageHandler" - } - }, - "customValues": {} - }, - { - "name": "name", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSString" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "addScriptMessageHandlerForControllerWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "removeScriptMessageHandler", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "name", - "type": { - "name": "String", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSString" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "removeScriptMessageHandlerForControllerWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "removeAllScriptMessageHandlers", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [], - "customValues": { - "objcName": "removeAllScriptMessageHandlersForControllerWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "addUserScript", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "userScript", - "type": { - "name": "WKUserScript", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "WKUserScript" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "addUserScriptForControllerWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "removeAllUserScripts", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [], - "customValues": { - "objcName": "removeAllUserScriptsForControllerWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "fromWebViewConfiguration", - "parameters": [ - { - "name": "configuration", - "type": { - "name": "WKWebViewConfiguration", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "UserContentController", - "isProtocol": false - } - }, - { - "name": "WKWebViewConfiguration", - "methods": [ - { - "name": "setAllowsInlineMediaPlayback", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "allow", - "type": { - "name": "bool", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSNumber" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setAllowsInlineMediaPlaybackForConfigurationWithIdentifier", - "returnsVoid": true - } - }, - { - "name": "setMediaTypesRequiringUserActionForPlayback", - "returnType": { - "name": "Future", - "nullable": false, - "typeArguments": [ - { - "name": "void", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": true, - "isClass": false, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "returnsVoid": false, - "static": false, - "parameters": [ - { - "name": "types", - "type": { - "name": "Set", - "nullable": false, - "typeArguments": [ - { - "name": "WKAudiovisualMediaType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - ], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": { - "objcName": "NSArray" - } - }, - "customValues": {} - } - ], - "customValues": { - "objcName": "setMediaTypesRequiresUserActionForConfigurationWithIdentifier", - "returnsVoid": true - } - } - ], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - }, - { - "name": "fromWebView", - "parameters": [ - { - "name": "webView", - "type": { - "name": "WKWebView", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [ - { - "name": "userContentController", - "type": { - "name": "WKUserContentController", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "preferences", - "type": { - "name": "WKPreferences", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "websiteDataStore", - "type": { - "name": "WKWebsiteDataStore", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": true, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ], - "customValues": { - "nameWithoutPrefix": "WebViewConfiguration", - "isProtocol": false - } - }, - { - "name": "WKUIDelegate", - "methods": [], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "UIDelegate", - "isProtocol": true - } - }, - { - "name": "WKNavigationDelegate", - "methods": [], - "constructors": [ - { - "name": "", - "parameters": [ - { - "name": "binaryMessenger", - "type": { - "name": "BinaryMessenger", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - }, - { - "name": "instanceManager", - "type": { - "name": "InstanceManager", - "nullable": true, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": true, - "isFunction": false, - "isEnum": false, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - }, - "customValues": {} - } - ] - } - ], - "fields": [], - "customValues": { - "nameWithoutPrefix": "NavigationDelegate", - "isProtocol": true - } - } - ], - "functions": [], - "enums": [ - { - "name": "WKUserScriptInjectionTime", - "values": [ - { - "name": "atDocumentStart", - "type": { - "name": "WKUserScriptInjectionTime", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "atDocumentEnd", - "type": { - "name": "WKUserScriptInjectionTime", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - }, - { - "name": "WKAudiovisualMediaType", - "values": [ - { - "name": "none", - "type": { - "name": "WKAudiovisualMediaType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "audio", - "type": { - "name": "WKAudiovisualMediaType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "video", - "type": { - "name": "WKAudiovisualMediaType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "all", - "type": { - "name": "WKAudiovisualMediaType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - }, - { - "name": "WKWebsiteDataType", - "values": [ - { - "name": "cookies", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "memoryCache", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "diskCache", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "offlineWebApplicationCache", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "localStorage", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "sessionStorage", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "webSQLDatabases", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - }, - { - "name": "indexedDBDatabases", - "type": { - "name": "WKWebsiteDataType", - "nullable": false, - "typeArguments": [], - "functionParameters": [], - "isVoid": false, - "isClass": false, - "isFunction": false, - "isEnum": true, - "isSimpleClass": false, - "isUnknownOrUnsupportedType": false, - "customValues": {} - } - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 0c81e4339b0c..f4e72b8f14eb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -20,8 +20,6 @@ dependencies: sdk: flutter path: ^1.8.0 webview_flutter_platform_interface: ^1.8.0 - simple_ast: - path: ../../../../penguin/packages/simple_ast dev_dependencies: build_runner: ^2.1.5 @@ -32,7 +30,3 @@ dev_dependencies: mockito: ^5.1.0 pedantic: ^1.10.0 pigeon: ^3.0.3 - code_template_processor: - path: ../../../../penguin/packages/code_template_processor - simple_ast_generator: - path: ../../../../penguin/packages/simple_ast_generator From d2c87621df824c16d62d0c22410c0123aeff0f60 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:41:22 -0700 Subject: [PATCH 16/23] remove simple ast and fix tests --- .../lib/src/foundation/foundation.dart | 34 +--- .../lib/src/ui_kit/ui_kit.dart | 36 +--- .../lib/src/web_kit/web_kit.dart | 154 ++++-------------- .../test/src/web_kit_webview_widget_test.dart | 10 +- 4 files changed, 44 insertions(+), 190 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index bdf824c21970..ec7bb5377de0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -6,16 +6,13 @@ import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; -import '../web_kit/web_kit.dart'; import 'foundation_api_impls.dart'; /// The values that can be returned in a change map. /// /// Wraps [NSKeyValueObservingOptions](https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc). -@SimpleEnumAnnotation() enum NSKeyValueObservingOptions { /// Indicates that the change map should provide the new attribute value, if applicable. /// @@ -41,7 +38,6 @@ enum NSKeyValueObservingOptions { /// The kinds of changes that can be observed. /// /// Wraps [NSKeyValueChange](https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc). -@SimpleEnumAnnotation() enum NSKeyValueChange { /// Indicates that the value of the observed key path was set to a new value. /// @@ -67,7 +63,6 @@ enum NSKeyValueChange { /// The keys that can appear in the change map. /// /// Wraps [NSKeyValueChangeKey](https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc). -@SimpleEnumAnnotation() enum NSKeyValueChangeKey { /// Indicates changes made in a collection. /// @@ -98,7 +93,6 @@ enum NSKeyValueChangeKey { /// The supported keys in a cookie attributes dictionary. /// /// Wraps [NSHTTPCookiePropertyKey](https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey). -@SimpleEnumAnnotation() enum NSHttpCookiePropertyKey { /// A String object containing the comment for the cookie. /// @@ -236,9 +230,6 @@ class NSHttpCookie { } /// The root class of most Objective-C class hierarchies. -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'Object', -}) class NSObject { /// Constructs an [NSObject]. NSObject({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) @@ -254,17 +245,10 @@ class NSObject { final NSObjectHostApiImpl _api; /// Registers the observer object to receive KVO notifications. - @SimpleMethodAnnotation(customValues: { - 'returnsVoid': true, - 'objcName': 'addObserverForObjectWithIdentifier', - }) Future addObserver( - @nsNumber NSObject observer, { - @nsString required String keyPath, - @SimpleTypeAnnotation(customValues: { - 'objcName': 'NSArray' - }) - required Set options, + NSObject observer, { + required String keyPath, + required Set options, }) { assert(options.isNotEmpty); return _api.addObserverForInstances( @@ -276,26 +260,16 @@ class NSObject { } /// Stops the observer object from receiving change notifications for the property. - @SimpleMethodAnnotation(customValues: { - 'returnsVoid': true, - 'objcName': 'removeObserverForObjectWithIdentifier', - }) - Future removeObserver(@nsNumber NSObject observer, - {@nsString required String keyPath}) { + Future removeObserver(NSObject observer, {required String keyPath}) { return _api.removeObserverForInstances(this, observer, keyPath); } /// Release the reference to the Objective-C object. - @SimpleMethodAnnotation(customValues: { - 'returnsVoid': true, - 'objcName': 'disposeObjectWithIdentifier', - }) Future dispose() { return _api.disposeForInstances(this); } /// Informs the observing object when the value at the specified key path has changed. - @SimpleMethodAnnotation(ignore: true) Future setObserveValue( void Function( String keyPath, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart index 4af57c17d00d..4d13854f7547 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart @@ -6,7 +6,6 @@ import 'dart:math'; import 'package:flutter/painting.dart' show Color; import 'package:flutter/services.dart'; -import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; import '../foundation/foundation.dart'; @@ -16,9 +15,6 @@ import 'ui_kit_api_impls.dart'; /// A view that allows the scrolling and zooming of its contained views. /// /// Wraps [UIScrollView](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc). -@SimpleClassAnnotation( - customValues: {'nameWithoutPrefix': 'ScrollView'}, -) class UIScrollView extends UIView { /// Constructs a [UIScrollView] that is owned by [webView]. UIScrollView.fromWebView( @@ -37,11 +33,6 @@ class UIScrollView extends UIView { /// Point at which the origin of the content view is offset from the origin of the scroll view. /// /// Represents [WKWebView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset?language=objc). - @nsNumber - @SimpleMethodAnnotation(customValues: { - 'objcName': 'contentOffsetForScrollViewWithIdentifier', - 'returnsVoid': false, - }) Future> getContentOffset() { return _scrollViewApi.getContentOffsetForInstances(this); } @@ -50,11 +41,7 @@ class UIScrollView extends UIView { /// /// This method is not a part of UIKit and is only a helper method to make /// scrollBy atomic. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'scrollByForScrollViewWithIdentifier', - 'returnsVoid': true, - }) - Future scrollBy(@nsNumber Point offset) { + Future scrollBy( Point offset) { return _scrollViewApi.scrollByForInstances(this, offset); } @@ -63,11 +50,7 @@ class UIScrollView extends UIView { /// The default value is `Point(0.0, 0.0)`. /// /// Sets [WKWebView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset?language=objc). - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setContentOffsetForScrollViewWithIdentifier', - 'returnsVoid': true, - }) - Future setContentOffset(@nsNumber Point offset) { + Future setContentOffset( Point offset) { return _scrollViewApi.setContentOffsetForInstances(this, offset); } } @@ -75,9 +58,6 @@ class UIScrollView extends UIView { /// Manages the content for a rectangular area on the screen. /// /// Wraps [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc). -@SimpleClassAnnotation( - customValues: {'nameWithoutPrefix': 'UIView'}, -) class UIView extends NSObject { /// Constructs an [NSObject]. UIView({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) @@ -93,22 +73,14 @@ class UIView extends NSObject { /// The default value is null, which results in a transparent background color. /// /// Sets [UIView.backgroundColor](https://developer.apple.com/documentation/uikit/uiview/1622591-backgroundcolor?language=objc). - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setBackgroundColorForViewWithIdentifier', - 'returnsVoid': true, - }) - Future setBackgroundColor(@nsNumber Color? color) { + Future setBackgroundColor( Color? color) { return _viewApi.setBackgroundColorForInstances(this, color); } /// Determines whether the view is opaque. /// /// Sets [UIView.opaque](https://developer.apple.com/documentation/uikit/uiview?language=objc). - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setOpaqueForViewWithIdentifier', - 'returnsVoid': true, - }) - Future setOpaque(@nsNumber bool opaque) { + Future setOpaque( bool opaque) { return _viewApi.setOpaqueForInstances(this, opaque); } } 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 9f6eb056cf0c..8f28fed733fb 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 @@ -4,29 +4,16 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import 'package:simple_ast/annotations.dart'; import '../common/instance_manager.dart'; import '../foundation/foundation.dart'; import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; -const SimpleTypeAnnotation nsObject = SimpleTypeAnnotation( - customValues: {'objcName': 'NSObject'}, -); - -const SimpleTypeAnnotation nsString = SimpleTypeAnnotation( - customValues: {'objcName': 'NSString'}, -); - -const SimpleTypeAnnotation nsNumber = SimpleTypeAnnotation( - customValues: {'objcName': 'NSNumber'}, -); - /// Times at which to inject script content into a webpage. /// /// Wraps [WKUserScriptInjectionTime](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc). -@SimpleEnumAnnotation() + enum WKUserScriptInjectionTime { /// Inject the script after the creation of the webpage’s document element, but before loading any other content. /// @@ -42,7 +29,7 @@ enum WKUserScriptInjectionTime { /// The media types that require a user gesture to begin playing. /// /// Wraps [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). -@SimpleEnumAnnotation() + enum WKAudiovisualMediaType { /// No media types require a user gesture to begin playing. /// @@ -68,7 +55,7 @@ enum WKAudiovisualMediaType { /// Types of data that websites store. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. -@SimpleEnumAnnotation() + enum WKWebsiteDataType { /// Cookies. cookies, @@ -226,10 +213,6 @@ class WKScriptMessage { /// Encapsulates the standard behaviors to apply to websites. /// /// Wraps [WKPreferences](https://developer.apple.com/documentation/webkit/wkpreferences?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'Preferences', - 'isProtocol': false, -}) class WKPreferences { /// Constructs a [WKPreferences] that is owned by [configuration]. @visibleForTesting @@ -253,11 +236,7 @@ class WKPreferences { /// Sets whether JavaScript is enabled. /// /// The default value is true. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setJavaScriptEnabledForPreferencesWithIdentifier', - 'returnsVoid': true, - }) - Future setJavaScriptEnabled(@nsNumber bool enabled) { + Future setJavaScriptEnabled(bool enabled) { return _preferencesApi.setJavaScriptEnabledForInstances(this, enabled); } } @@ -265,10 +244,7 @@ class WKPreferences { /// Manages cookies, disk and memory caches, and other types of data for a web view. /// /// Wraps [WKWebsiteDataStore](https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'WebsiteDataStore', - 'isProtocol': false, -}) + class WKWebsiteDataStore { WKWebsiteDataStore._({ BinaryMessenger? binaryMessenger, @@ -318,17 +294,10 @@ class WKWebsiteDataStore { /// Removes website data that changed after the specified date. /// /// Returns whether any data was removed. - @nsNumber - @SimpleMethodAnnotation(customValues: { - 'objcName': 'removeDataFromDataStoreWithIdentifier', - 'returnsVoid': false, - }) + Future removeDataOfTypes( - @SimpleTypeAnnotation(customValues: { - 'objcName': 'NSArray' - }) - Set dataTypes, - @nsNumber DateTime since, + Set dataTypes, + DateTime since, ) { return _websiteDataStoreApi.removeDataOfTypesForInstances( this, @@ -341,10 +310,7 @@ class WKWebsiteDataStore { /// An object that manages the HTTP cookies associated with a particular web view. /// /// Wraps [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'HttpCookieStore', - 'isProtocol': false, -}) + class WKHttpCookieStore extends NSObject { WKHttpCookieStore._({ BinaryMessenger? binaryMessenger, @@ -375,15 +341,8 @@ class WKHttpCookieStore extends NSObject { final WKHttpCookieStoreHostApiImpl _httpCookieStoreApi; /// Adds a cookie to the cookie store. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setCookieForStoreWithIdentifier', - 'returnsVoid': true, - }) - Future setCookie( - @SimpleTypeAnnotation(customValues: { - 'objcName': 'NSHttpCookie' - }) - NSHttpCookie cookie) { + + Future setCookie(NSHttpCookie cookie) { return _httpCookieStoreApi.setCookieForInsances(this, cookie); } } @@ -391,10 +350,7 @@ class WKHttpCookieStore extends NSObject { /// An interface for receiving messages from JavaScript code running in a webpage. /// /// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc) -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'ScriptMessageHandler', - 'isProtocol': true, -}) + class WKScriptMessageHandler { /// Constructs a [WKScriptMessageHandler]. WKScriptMessageHandler({ @@ -414,7 +370,6 @@ class WKScriptMessageHandler { /// Use this method to respond to a message sent from the webpage’s /// JavaScript code. Use the [message] parameter to get the message contents and /// to determine the originating web view. - @SimpleMethodAnnotation(ignore: true) Future setDidReceiveScriptMessage( void Function( WKUserContentController userContentController, @@ -435,10 +390,7 @@ class WKScriptMessageHandler { /// code. /// /// Wraps [WKUserContentController](https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'UserContentController', - 'isProtocol': false, -}) + class WKUserContentController { /// Constructs a [WKUserContentController] that is owned by [configuration]. @visibleForTesting @@ -469,16 +421,10 @@ class WKUserContentController { /// specify the string `MyFunction`, the user content controller defines the ` /// `window.webkit.messageHandlers.MyFunction.postMessage()` function in /// JavaScript. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'addScriptMessageHandlerForControllerWithIdentifier', - 'returnsVoid': true, - }) + Future addScriptMessageHandler( - @SimpleTypeAnnotation(customValues: { - 'objcName': 'WKScriptMessageHandler' - }) - WKScriptMessageHandler handler, - @nsString String name, + WKScriptMessageHandler handler, + String name, ) { assert(name.isNotEmpty); return _userContentControllerApi.addScriptMessageHandlerForInstances( @@ -497,11 +443,8 @@ class WKUserContentController { /// using the [addScriptMessageHandler] method. This method removes the /// message handler from the page content world. If you installed the message /// handler in a different content world, this method doesn’t remove it. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'removeScriptMessageHandlerForControllerWithIdentifier', - 'returnsVoid': true, - }) - Future removeScriptMessageHandler(@nsString String name) { + + Future removeScriptMessageHandler(String name) { return _userContentControllerApi.removeScriptMessageHandlerForInstances( this, name, @@ -509,10 +452,7 @@ class WKUserContentController { } /// Uninstalls all custom message handlers associated with the user content controller. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'removeAllScriptMessageHandlersForControllerWithIdentifier', - 'returnsVoid': true, - }) + Future removeAllScriptMessageHandlers() { return _userContentControllerApi.removeAllScriptMessageHandlersForInstances( this, @@ -520,24 +460,14 @@ class WKUserContentController { } /// Injects the specified script into the webpage’s content. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'addUserScriptForControllerWithIdentifier', - 'returnsVoid': true, - }) - Future addUserScript( - @SimpleTypeAnnotation(customValues: { - 'objcName': 'WKUserScript' - }) - WKUserScript userScript) { + + Future addUserScript(WKUserScript userScript) { return _userContentControllerApi.addUserScriptForInstances( this, userScript); } /// Removes all user scripts from the web view. - @SimpleMethodAnnotation(customValues: { - 'objcName': 'removeAllUserScriptsForControllerWithIdentifier', - 'returnsVoid': true, - }) + Future removeAllUserScripts() { return _userContentControllerApi.removeAllUserScriptsForInstances(this); } @@ -546,10 +476,7 @@ class WKUserContentController { /// A collection of properties that you use to initialize a web view. /// /// Wraps [WKWebViewConfiguration](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'WebViewConfiguration', - 'isProtocol': false, -}) + class WKWebViewConfiguration { /// Constructs a [WKWebViewConfiguration]. factory WKWebViewConfiguration({ @@ -622,11 +549,8 @@ class WKWebViewConfiguration { /// Indicates whether HTML5 videos play inline or use the native full-screen controller. /// /// Sets [WKWebViewConfiguration.allowsInlineMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback?language=objc). - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setAllowsInlineMediaPlaybackForConfigurationWithIdentifier', - 'returnsVoid': true, - }) - Future setAllowsInlineMediaPlayback(@nsNumber bool allow) { + + Future setAllowsInlineMediaPlayback(bool allow) { return _webViewConfigurationApi.setAllowsInlineMediaPlaybackForInstances( this, allow, @@ -639,15 +563,9 @@ class WKWebViewConfiguration { /// required to begin playing media. /// /// Sets [WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor?language=objc). - @SimpleMethodAnnotation(customValues: { - 'objcName': 'setMediaTypesRequiresUserActionForConfigurationWithIdentifier', - 'returnsVoid': true, - }) + Future setMediaTypesRequiringUserActionForPlayback( - @SimpleTypeAnnotation(customValues: { - 'objcName': 'NSArray' - }) - Set types, + Set types, ) { assert(types.isNotEmpty); return _webViewConfigurationApi @@ -661,10 +579,7 @@ class WKWebViewConfiguration { /// The methods for presenting native user interface elements on behalf of a webpage. /// /// Wraps [WKUIDelegate](https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'UIDelegate', - 'isProtocol': true, -}) + class WKUIDelegate { /// Constructs a [WKUIDelegate]. WKUIDelegate({ @@ -680,7 +595,7 @@ class WKUIDelegate { final WKUIDelegateHostApiImpl _uiDelegateApi; /// Indicates a new [WKWebView] was requested to be created with [configuration]. - @SimpleMethodAnnotation(ignore: true) + Future setOnCreateWebView( void Function( WKWebViewConfiguration configuration, @@ -698,10 +613,7 @@ class WKUIDelegate { /// coordinate changes in your web view’s main frame. /// /// Wraps [WKNavigationDelegate](https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc). -@SimpleClassAnnotation(customValues: { - 'nameWithoutPrefix': 'NavigationDelegate', - 'isProtocol': true, -}) + class WKNavigationDelegate extends NSObject { /// Constructs a [WKNavigationDelegate]. WKNavigationDelegate({ @@ -722,7 +634,6 @@ class WKNavigationDelegate extends NSObject { final WKNavigationDelegateHostApiImpl _navigationDelegateApi; /// Called when navigation from the main frame has started. - @SimpleMethodAnnotation(ignore: true) Future setDidStartProvisionalNavigation( void Function(WKWebView webView, String? url)? didStartProvisionalNavigation, @@ -731,7 +642,6 @@ class WKNavigationDelegate extends NSObject { } /// Called when navigation is complete. - @SimpleMethodAnnotation(ignore: true) Future setDidFinishNavigation( void Function(WKWebView webView, String? url)? didFinishNavigation, ) { @@ -742,7 +652,6 @@ class WKNavigationDelegate extends NSObject { } /// Called when permission is needed to navigate to new content. - @SimpleMethodAnnotation(ignore: true) Future setDecidePolicyForNavigationAction( Future Function( WKWebView webView, @@ -753,7 +662,6 @@ class WKNavigationDelegate extends NSObject { } /// Called when an error occurred during navigation. - @SimpleMethodAnnotation(ignore: true) Future setDidFailNavigation( void Function(WKWebView webView, NSError error)? didFailNavigation, ) { @@ -761,7 +669,6 @@ class WKNavigationDelegate extends NSObject { } /// Called when an error occurred during the early navigation process. - @SimpleMethodAnnotation(ignore: true) Future setDidFailProvisionalNavigation( void Function(WKWebView webView, NSError error)? didFailProvisionalNavigation, @@ -770,7 +677,6 @@ class WKNavigationDelegate extends NSObject { } /// Called when the web view’s content process was terminated. - @SimpleMethodAnnotation(ignore: true) Future setWebViewWebContentProcessDidTerminate( void Function(WKWebView webView)? webViewWebContentProcessDidTerminate, ) { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart index 2eadb7ffc462..056809ed181e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart @@ -332,7 +332,7 @@ void main() { final List javaScriptChannels = verifyInOrder([ mockUserContentController.removeAllUserScripts(), - mockUserContentController.removeAllScriptMessageHandlers(), + mockUserContentController.removeScriptMessageHandler('myChannel'), mockUserContentController.addScriptMessageHandler( captureAny, captureAny, @@ -374,7 +374,6 @@ void main() { )); verify(mockUserContentController.removeAllUserScripts()); - verify(mockUserContentController.removeAllScriptMessageHandlers()); verifyNever(mockUserContentController.addScriptMessageHandler( any, any, @@ -837,12 +836,15 @@ void main() { await testController.removeJavascriptChannels({'c'}); - verify(mockUserContentController.removeAllScriptMessageHandlers()); verify(mockUserContentController.removeAllUserScripts()); + verify(mockUserContentController.removeScriptMessageHandler('c')); + verify(mockUserContentController.removeScriptMessageHandler('d')); final List javaScriptChannels = verify( mockUserContentController.addScriptMessageHandler( - captureAny, captureAny), + captureAny, + captureAny, + ), ).captured; expect( javaScriptChannels[0], From fe35717efdedeadfeb3ec3e06a9534e2faf6ea2e Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 10:42:34 -0700 Subject: [PATCH 17/23] remove template files --- .../lib/src/web_kit/data_template.h | 10 -- .../lib/src/web_kit/data_template.m | 12 --- .../lib/src/web_kit/template.h | 32 ------- .../lib/src/web_kit/template.m | 96 ------------------- .../lib/src/web_kit/template_test.m | 91 ------------------ 5 files changed, 241 deletions(-) delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h deleted file mode 100644 index 5918169d8b91..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.h +++ /dev/null @@ -1,10 +0,0 @@ -/*-iterate enums enum*/ -/** - * Converts an FWF__name__EnumData to an __name__. - * - * @param data The data object containing information to create an __name__. - * - * @return An __name__ or -1 if data could not be converted. - */ -extern __name__ FWF__name__FromEnumData(FWF__name__EnumData* data); -/*-*/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m deleted file mode 100644 index 95fdab7d411a..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/data_template.m +++ /dev/null @@ -1,12 +0,0 @@ -/*iterate enums enum*/ -__name__ FWF__name__FromEnumData(FWF__name__EnumData *data) { - switch (data.value) { - /*iterate values value*/ - case FWF__enum_name__Enum /*replace :case=pascal name*/ name /**/: - return __enum_name__ /*replace :case=pascal name*/ name /**/; - /**/ - } - - return -1; -} -/**/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h deleted file mode 100644 index 4a45273a3779..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.h +++ /dev/null @@ -1,32 +0,0 @@ -/*-iterate classes class*/ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import -#import - -#import "FWFGeneratedWebKitApis.h" -#import "FWFInstanceManager.h" - -NS_ASSUME_NONNULL_BEGIN - -/*-if customValues_isProtocol*/ -/** - * Implementation of __name__ for FWF__customValues_nameWithoutPrefix__HostApiImpl. - */ -@interface FWF__customValues_nameWithoutPrefix__ : NSObject <__name__> -@end -/*-*/ - -/** - * Host api implementation for __name__. - * - * Handles creating __name__ that intercommunicate with a paired Dart object. - */ -@interface FWF__customValues_nameWithoutPrefix__HostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -@end - -NS_ASSUME_NONNULL_END -/*-*/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m deleted file mode 100644 index 057c9d21557f..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template.m +++ /dev/null @@ -1,96 +0,0 @@ -/*iterate classes class*/ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "FWFDataConverters.h" -#import "FWFWebViewConfigurationHostApi.h" -#import "FWF__customValues_nameWithoutPrefix__HostApi.h" - -/*if customValues_isProtocol*/ -@implementation FWF__customValues_nameWithoutPrefix__ -@end -/**/ - -@interface FWF__customValues_nameWithoutPrefix__HostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; -@end - -@implementation FWF__customValues_nameWithoutPrefix__HostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - self = [self init]; - if (self) { - _instanceManager = instanceManager; - } - return self; -} - -- (/*if customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ - /**/ - *)/*replace :case=camel customValues_nameWithoutPrefix*/ name - /**/ ForIdentifier:(NSNumber *)instanceId { - return ( - /*if customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ - /**/ - *)[self.instanceManager instanceForIdentifier:instanceId.longValue]; -} - -- (void)createWithIdentifier:(nonnull NSNumber *)instanceId - error:(FlutterError *_Nullable *_Nonnull)error { - /*if customValues_isProtocol*/ - FWF__customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ - /**/ - * /*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ - = - /*if customValues_isProtocol*/ - [[FWF__customValues_nameWithoutPrefix__ alloc] init]; - /**/ - /*if! customValues_isProtocol*/ - [[__name__ alloc] init]; - /**/ - [self.instanceManager addInstance:/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ - withIdentifier:instanceId.longValue]; -} - -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)instanceId - configurationIdentifier:(nonnull NSNumber *)configurationInstanceId - error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationInstanceId.longValue]; - [self.instanceManager - addInstance:configuration./*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ - withIdentifier:instanceId.longValue]; -} - -/*iterate methods method*/ -- (void)__customValues_objcName__:(nonnull NSNumber *)instanceId - /*iterate parameters parameter*/ - __name__:(/*if type_nullable*/ nullable /**/ /*if! type_nullable*/ - nonnull /**/ __type_customValues_objcName__ *)__name__ - /**/ - error:(FlutterError *_Nullable *_Nonnull)error { - /*if! customValues_returnsVoid*/ return /**/ - [[self /*replace :case=camel class_customValues_nameWithoutPrefix*/ - name /**/ ForIdentifier:instanceId] __name__ -/*iterate :end=1 parameters parameter*/ -:__name__ - /**/ - /*iterate :start=1 parameters parameter*/ - __name__:__name__ - /**/ - ]; -} -/**/ -@end -/**/ \ No newline at end of file diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m deleted file mode 100644 index 0544664c0606..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/template_test.m +++ /dev/null @@ -1,91 +0,0 @@ -/*iterate classes class*/ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import Flutter; -@import XCTest; -@import webview_flutter_wkwebview; - -#import - -@interface FWF__customValues_nameWithoutPrefix__HostApiTests : XCTestCase -@end - -@implementation FWF__customValues_nameWithoutPrefix__HostApiTests -- (void)testCreateWithIdentifier { - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWF__customValues_nameWithoutPrefix__HostApiImpl *hostApi = - [[FWF__customValues_nameWithoutPrefix__HostApiImpl alloc] - initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi createWithIdentifier:@0 error:&error]; - /*if customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ /**/ - * /*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ - = ( - /*if customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ - /**/ - /*if! customValues_isProtocol*/ - __name__ /**/ - *)[instanceManager instanceForIdentifier:0]; - /*if customValues_isProtocol*/ - XCTAssertTrue( - [/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ conformsToProtocol: - @protocol(__name__)]); - /**/ - /*if! customValues_isProtocol*/ - XCTAssertTrue( - [/*replace :case=camel customValues_nameWithoutPrefix*/ name /**/ isKindOfClass:[__name__ - class]]); - /**/ - XCTAssertNil(error); -} - -/*iterate methods method*/ -- (void)test /*replace :case=pascal name*/ methodName /**/ { - /*if class_customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ - /**/ - /*if! class_customValues_isProtocol*/ - __class_name__ - /**/ *mock__class_customValues_nameWithoutPrefix__ = OCMClassMock([ - /*if class_customValues_isProtocol*/ - FWF__class_customValues_nameWithoutPrefix__ - /**/ - /*if! class_customValues_isProtocol*/ - __class_name__ - /**/ - class]); - - FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - [instanceManager addInstance:mock__class_customValues_nameWithoutPrefix__ withIdentifier:0]; - - FWF__class_customValues_nameWithoutPrefix__HostApiImpl *hostApi = - [[FWF__class_customValues_nameWithoutPrefix__HostApiImpl alloc] - initWithInstanceManager:instanceManager]; - - FlutterError *error; - [hostApi __customValues_objcName__:@0 - /*iterate parameters parameter*/ - __name__:aValue - /**/ - error:&error]; - OCMVerify([mock__class_customValues_nameWithoutPrefix__ __name__ -/*iterate :end=1 parameters parameter*/ -:aValue - /**/ - /*iterate :start=1 parameters parameter*/ - __name__:aValue - /**/ - ]); - XCTAssertNil(error); -} -/**/ -@end -/**/ \ No newline at end of file From 8509944b29c996f6762fbe99ae759ad4a3fe1915 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 11:11:36 -0700 Subject: [PATCH 18/23] lints bro --- .../example/ios/RunnerTests/FWFPreferencesHostApiTests.m | 6 +----- .../example/ios/RunnerTests/FWFUIDelegateHostApiTests.m | 1 - .../RunnerTests/FWFUserContentControllerHostApiTests.m | 8 ++------ .../ios/Classes/FWFDataConverters.h | 1 - .../ios/Classes/FWFNavigationDelegateHostApi.m | 7 +++++++ .../ios/Classes/FWFScrollViewHostApi.m | 1 - .../ios/Classes/FWFUIViewHostApi.m | 1 - .../webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart | 8 ++++---- 8 files changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index 82b68affae06..1837a9373930 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -37,11 +37,7 @@ - (void)testSetJavaScriptEnabled { FlutterError *error; [hostApi setJavaScriptEnabledForPreferencesWithIdentifier:@0 isEnabled:@YES error:&error]; - OCMVerify([mockPreferences setJavaScriptEnabled - -:YES - - ]); + OCMVerify([mockPreferences setJavaScriptEnabled:YES]); XCTAssertNil(error); } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m index c17fcbe4bf81..2f7838be5aa8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m @@ -24,5 +24,4 @@ - (void)testCreateWithIdentifier { XCTAssertTrue([delegate conformsToProtocol:@protocol(WKUIDelegate)]); XCTAssertNil(error); } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m index 09c6617786ca..d70341e87890 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m @@ -77,9 +77,7 @@ - (void)testRemoveAllScriptMessageHandlers API_AVAILABLE(ios(14.0)) { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 - - error:&error]; + [hostApi removeAllScriptMessageHandlersForControllerWithIdentifier:@0 error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers]); XCTAssertNil(error); } @@ -122,9 +120,7 @@ - (void)testRemoveAllUserScripts { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 - - error:&error]; + [hostApi removeAllUserScriptsForControllerWithIdentifier:@0 error:&error]; OCMVerify([mockUserContentController removeAllUserScripts]); XCTAssertNil(error); } 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 854bb7e06c9e..1f5506b5eb6c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -8,7 +8,6 @@ NS_ASSUME_NONNULL_BEGIN -// TODO: Some should take an NSError /** * Converts an FWFNSUrlRequestData to an NSURLRequest. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m index 0e4f079a584f..188d83ff81b6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -30,4 +30,11 @@ - (void)createWithIdentifier:(nonnull NSNumber *)instanceId FWFNavigationDelegate *navigationDelegate = [[FWFNavigationDelegate alloc] init]; [self.instanceManager addInstance:navigationDelegate withIdentifier:instanceId.longValue]; } + +- (void)setDidFinishNavigationForDelegateWithIdentifier:(nonnull NSNumber *)instanceId + functionIdentifier:(nullable NSNumber *)functionInstanceId + error:(FlutterError *_Nullable __autoreleasing + *_Nonnull)error { + // TODO(bparrishMines): Implement when callback method design is finalized. +} @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m index d34ba7fd3829..a7522995e0e1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -54,5 +54,4 @@ - (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)instance [[self scrollViewForIdentifier:instanceId] setContentOffset:CGPointMake(x.doubleValue, y.doubleValue)]; } - @end 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 90582323539c..b2c1f639d1f6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -40,5 +40,4 @@ - (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { [[self viewForIdentifier:instanceId] setOpaque:opaque.boolValue]; } - @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart index 4d13854f7547..7c1bdd01724c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart @@ -41,7 +41,7 @@ class UIScrollView extends UIView { /// /// This method is not a part of UIKit and is only a helper method to make /// scrollBy atomic. - Future scrollBy( Point offset) { + Future scrollBy(Point offset) { return _scrollViewApi.scrollByForInstances(this, offset); } @@ -50,7 +50,7 @@ class UIScrollView extends UIView { /// The default value is `Point(0.0, 0.0)`. /// /// Sets [WKWebView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset?language=objc). - Future setContentOffset( Point offset) { + Future setContentOffset(Point offset) { return _scrollViewApi.setContentOffsetForInstances(this, offset); } } @@ -73,14 +73,14 @@ class UIView extends NSObject { /// The default value is null, which results in a transparent background color. /// /// Sets [UIView.backgroundColor](https://developer.apple.com/documentation/uikit/uiview/1622591-backgroundcolor?language=objc). - Future setBackgroundColor( Color? color) { + Future setBackgroundColor(Color? color) { return _viewApi.setBackgroundColorForInstances(this, color); } /// Determines whether the view is opaque. /// /// Sets [UIView.opaque](https://developer.apple.com/documentation/uikit/uiview?language=objc). - Future setOpaque( bool opaque) { + Future setOpaque(bool opaque) { return _viewApi.setOpaqueForInstances(this, opaque); } } From b721b688a00e46c7f3cfb648453a7b7645bc4fc4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 3 May 2022 14:33:32 -0700 Subject: [PATCH 19/23] shorthand --- .../webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index 7f94977fb3b5..b229c2e819a9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -49,6 +49,6 @@ - (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)instanceId - (void)disposeObjectWithIdentifier:(nonnull NSNumber *)instanceId error:(FlutterError *_Nullable *_Nonnull)error { - [self.instanceManager removeInstance:[self objectForIdentifier:instanceId]]; + [self.instanceManager removeInstanceWithIdentifier:instanceId.longValue]; } @end From bdcfff96515574ffbc5cc35c681b8d9eb664903f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 4 May 2022 12:20:58 -0700 Subject: [PATCH 20/23] fix message --- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m index e185230ce868..6ebd60a4ac40 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -34,9 +34,10 @@ - (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)instanceId [self.instanceManager addInstance:dataStore.httpCookieStore withIdentifier:instanceId.longValue]; } else { - *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" - message:@"setCookie is only supported on versions 11+." - details:nil]; + *error = [FlutterError + errorWithCode:@"FWFUnsupportedVersionError" + message:@"WKWebsiteDataStore.httpCookieStore is only supported on versions 11+." + details:nil]; } } From de645bd5b389f38323b582c23afdc96443e871c2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 9 May 2022 21:57:39 -0700 Subject: [PATCH 21/23] review comments --- .../ios/RunnerTests/FWFDataConvertersTests.m | 12 +++++ .../ios/Classes/FWFDataConverters.m | 5 +- .../ios/Classes/FWFGeneratedWebKitApis.h | 12 ++++- .../ios/Classes/FWFGeneratedWebKitApis.m | 4 +- .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 24 ++++----- .../lib/src/common/web_kit.pigeon.dart | 54 ++++++++----------- .../lib/src/foundation/foundation.dart | 3 ++ .../lib/src/web_kit/web_kit.dart | 25 ++------- .../lib/src/web_kit/web_kit_api_impls.dart | 7 ++- .../lib/src/web_kit_webview_widget.dart | 3 ++ .../pigeons/web_kit.dart | 38 +++++++++---- .../test/src/common/test_web_kit.pigeon.dart | 11 ++-- 12 files changed, 108 insertions(+), 90 deletions(-) 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 57d90f6c6814..733ee29d237f 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 @@ -32,6 +32,18 @@ - (void)testFWFNSHTTPCookieFromCookieData { [NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"cookieName"}]); } +- (void)testFWFNSHTTPCookieFromCookieDataIgnoresSameSitePolicy { + NSHTTPCookie *cookie = FWFNSHTTPCookieFromCookieData([FWFNSHttpCookieData + makeWithPropertyKeys:@[ + [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName], + [FWFNSHttpCookiePropertyKeyEnumData + makeWithValue:FWFNSHttpCookiePropertyKeyEnumSameSitePolicy] + ] + propertyValues:@[ @"cookieName", @"cookiePolicy" ]]); + XCTAssertEqualObjects(cookie, + [NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"cookieName"}]); +} + - (void)testFWFWKUserScriptFromScriptData { WKUserScript *userScript = FWFWKUserScriptFromScriptData([FWFWKUserScriptData makeWithSource:@"mySource" 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 b47a6475df4e..a06b3d79b38c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -30,7 +30,9 @@ NSHTTPCookiePropertyKey cookieKey = FWFNSHTTPCookiePropertyKeyFromEnumData(data.propertyKeys[i]); if (!cookieKey) { - return nil; + // Some keys aren't supported on all versions, so this ignores keys + // that require a higher version or are unsupported. + continue; } [properties setObject:data.propertyValues[i] forKey:cookieKey]; } @@ -80,7 +82,6 @@ NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( if (@available(iOS 13.0, *)) { return NSHTTPCookieSameSitePolicy; } else { - NSLog(@"NSHTTPCookieSameSitePolicy is only supported on iOS 13+."); return nil; } case FWFNSHttpCookiePropertyKeyEnumSecure: 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 23b22084f10a..7d2bd44050ea 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -88,26 +88,36 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { @class FWFNSHttpCookieData; @interface FWFNSKeyValueObservingOptionsEnumData : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value; @property(nonatomic, assign) FWFNSKeyValueObservingOptionsEnum value; @end @interface FWFWKUserScriptInjectionTimeEnumData : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValue:(FWFWKUserScriptInjectionTimeEnum)value; @property(nonatomic, assign) FWFWKUserScriptInjectionTimeEnum value; @end @interface FWFWKAudiovisualMediaTypeEnumData : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValue:(FWFWKAudiovisualMediaTypeEnum)value; @property(nonatomic, assign) FWFWKAudiovisualMediaTypeEnum value; @end @interface FWFWKWebsiteDataTypeEnumData : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value; @property(nonatomic, assign) FWFWKWebsiteDataTypeEnum value; @end @interface FWFNSHttpCookiePropertyKeyEnumData : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValue:(FWFNSHttpCookiePropertyKeyEnum)value; @property(nonatomic, assign) FWFNSHttpCookiePropertyKeyEnum value; @end @@ -156,7 +166,7 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); error:(FlutterError *_Nullable *_Nonnull)error; - (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)instanceId ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)secondsModifiedSinceEpoch + modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index fa5553334196..aaeccc5cc1b0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -359,10 +359,10 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge NSArray *args = message; NSNumber *arg_instanceId = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_secondsModifiedSinceEpoch = GetNullableObjectAtIndex(args, 2); + NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); [api removeDataFromDataStoreWithIdentifier:arg_instanceId ofTypes:arg_dataTypes - modifiedSince:arg_secondsModifiedSinceEpoch + modifiedSince:arg_modificationTimeInSecondsSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m index 78492e0d3366..e052ae03543c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -39,13 +39,13 @@ - (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)instanceId withIdentifier:instanceId.longValue]; } -- (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId - ofTypes:(nonnull NSArray *) - dataTypes - modifiedSince:(nonnull NSNumber *)secondsModifiedSinceEpoch - completion: - (nonnull void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion { +- (void) + removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId + ofTypes: + (nonnull NSArray *)dataTypes + modifiedSince:(nonnull NSNumber *)modificationTimeInSecondsSinceEpoch + completion:(nonnull void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion { NSMutableSet *stringDataTypes = [NSMutableSet set]; for (FWFWKWebsiteDataTypeEnumData *type in dataTypes) { [stringDataTypes addObject:FWFWKWebsiteDataTypeFromEnumData(type)]; @@ -57,14 +57,10 @@ - (void)removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)instanceId completionHandler:^(NSArray *records) { [dataStore removeDataOfTypes:stringDataTypes - modifiedSince:[NSDate dateWithTimeIntervalSince1970:secondsModifiedSinceEpoch - .doubleValue] + modifiedSince:[NSDate dateWithTimeIntervalSince1970: + modificationTimeInSecondsSinceEpoch.doubleValue] completionHandler:^{ - if (records.count > 0) { - completion(@YES, nil); - } else { - completion(@NO, nil); - } + completion(@(records.count > 0), nil); }]; }]; } 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 e7ee130a35c3..f84ba68bfbc1 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 @@ -80,115 +80,105 @@ enum NSHttpCookiePropertyKeyEnum { class NSKeyValueObservingOptionsEnumData { NSKeyValueObservingOptionsEnumData({ - this.value, + required this.value, }); - NSKeyValueObservingOptionsEnum? value; + NSKeyValueObservingOptionsEnum value; Object encode() { final Map pigeonMap = {}; - pigeonMap['value'] = value?.index; + pigeonMap['value'] = value.index; return pigeonMap; } static NSKeyValueObservingOptionsEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSKeyValueObservingOptionsEnumData( - value: pigeonMap['value'] != null - ? NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int] - : null, + value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int], ); } } class WKUserScriptInjectionTimeEnumData { WKUserScriptInjectionTimeEnumData({ - this.value, + required this.value, }); - WKUserScriptInjectionTimeEnum? value; + WKUserScriptInjectionTimeEnum value; Object encode() { final Map pigeonMap = {}; - pigeonMap['value'] = value?.index; + pigeonMap['value'] = value.index; return pigeonMap; } static WKUserScriptInjectionTimeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKUserScriptInjectionTimeEnumData( - value: pigeonMap['value'] != null - ? WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int] - : null, + value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int], ); } } class WKAudiovisualMediaTypeEnumData { WKAudiovisualMediaTypeEnumData({ - this.value, + required this.value, }); - WKAudiovisualMediaTypeEnum? value; + WKAudiovisualMediaTypeEnum value; Object encode() { final Map pigeonMap = {}; - pigeonMap['value'] = value?.index; + pigeonMap['value'] = value.index; return pigeonMap; } static WKAudiovisualMediaTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKAudiovisualMediaTypeEnumData( - value: pigeonMap['value'] != null - ? WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int] - : null, + value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int], ); } } class WKWebsiteDataTypeEnumData { WKWebsiteDataTypeEnumData({ - this.value, + required this.value, }); - WKWebsiteDataTypeEnum? value; + WKWebsiteDataTypeEnum value; Object encode() { final Map pigeonMap = {}; - pigeonMap['value'] = value?.index; + pigeonMap['value'] = value.index; return pigeonMap; } static WKWebsiteDataTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKWebsiteDataTypeEnumData( - value: pigeonMap['value'] != null - ? WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int] - : null, + value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int], ); } } class NSHttpCookiePropertyKeyEnumData { NSHttpCookiePropertyKeyEnumData({ - this.value, + required this.value, }); - NSHttpCookiePropertyKeyEnum? value; + NSHttpCookiePropertyKeyEnum value; Object encode() { final Map pigeonMap = {}; - pigeonMap['value'] = value?.index; + pigeonMap['value'] = value.index; return pigeonMap; } static NSHttpCookiePropertyKeyEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookiePropertyKeyEnumData( - value: pigeonMap['value'] != null - ? NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int] - : null, + value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int], ); } } @@ -377,14 +367,14 @@ class WKWebsiteDataStoreHostApi { Future removeDataOfTypes( int arg_instanceId, List arg_dataTypes, - double arg_secondsModifiedSinceEpoch) async { + double arg_modificationTimeInSecondsSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = await channel.send([ arg_instanceId, arg_dataTypes, - arg_secondsModifiedSinceEpoch + arg_modificationTimeInSecondsSinceEpoch ]) as Map?; if (replyMap == null) { throw PlatformException( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart index ec7bb5377de0..5c127c5654c6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart @@ -146,6 +146,9 @@ enum NSHttpCookiePropertyKey { /// A String indicating the same-site policy for the cookie. /// + /// This is only supported on iOS version 13+. This value will be ignored on + /// versions < 13. + /// /// See https://developer.apple.com/documentation/foundation/nshttpcookiesamesitepolicy. sameSitePolicy, 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 8f28fed733fb..88f763fe6ba3 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 @@ -13,7 +13,6 @@ import 'web_kit_api_impls.dart'; /// Times at which to inject script content into a webpage. /// /// Wraps [WKUserScriptInjectionTime](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc). - enum WKUserScriptInjectionTime { /// Inject the script after the creation of the webpage’s document element, but before loading any other content. /// @@ -29,7 +28,6 @@ enum WKUserScriptInjectionTime { /// The media types that require a user gesture to begin playing. /// /// Wraps [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). - enum WKAudiovisualMediaType { /// No media types require a user gesture to begin playing. /// @@ -55,7 +53,6 @@ enum WKAudiovisualMediaType { /// Types of data that websites store. /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. - enum WKWebsiteDataType { /// Cookies. cookies, @@ -244,7 +241,6 @@ class WKPreferences { /// Manages cookies, disk and memory caches, and other types of data for a web view. /// /// Wraps [WKWebsiteDataStore](https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc). - class WKWebsiteDataStore { WKWebsiteDataStore._({ BinaryMessenger? binaryMessenger, @@ -294,7 +290,6 @@ class WKWebsiteDataStore { /// Removes website data that changed after the specified date. /// /// Returns whether any data was removed. - Future removeDataOfTypes( Set dataTypes, DateTime since, @@ -310,7 +305,6 @@ class WKWebsiteDataStore { /// An object that manages the HTTP cookies associated with a particular web view. /// /// Wraps [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc). - class WKHttpCookieStore extends NSObject { WKHttpCookieStore._({ BinaryMessenger? binaryMessenger, @@ -341,7 +335,6 @@ class WKHttpCookieStore extends NSObject { final WKHttpCookieStoreHostApiImpl _httpCookieStoreApi; /// Adds a cookie to the cookie store. - Future setCookie(NSHttpCookie cookie) { return _httpCookieStoreApi.setCookieForInsances(this, cookie); } @@ -350,7 +343,6 @@ class WKHttpCookieStore extends NSObject { /// An interface for receiving messages from JavaScript code running in a webpage. /// /// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc) - class WKScriptMessageHandler { /// Constructs a [WKScriptMessageHandler]. WKScriptMessageHandler({ @@ -390,7 +382,6 @@ class WKScriptMessageHandler { /// code. /// /// Wraps [WKUserContentController](https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc). - class WKUserContentController { /// Constructs a [WKUserContentController] that is owned by [configuration]. @visibleForTesting @@ -421,7 +412,6 @@ class WKUserContentController { /// specify the string `MyFunction`, the user content controller defines the ` /// `window.webkit.messageHandlers.MyFunction.postMessage()` function in /// JavaScript. - Future addScriptMessageHandler( WKScriptMessageHandler handler, String name, @@ -443,7 +433,6 @@ class WKUserContentController { /// using the [addScriptMessageHandler] method. This method removes the /// message handler from the page content world. If you installed the message /// handler in a different content world, this method doesn’t remove it. - Future removeScriptMessageHandler(String name) { return _userContentControllerApi.removeScriptMessageHandlerForInstances( this, @@ -451,8 +440,10 @@ class WKUserContentController { ); } - /// Uninstalls all custom message handlers associated with the user content controller. - + /// Uninstalls all custom message handlers associated with the user content + /// controller. + /// + /// Only supported on iOS version 14+. Future removeAllScriptMessageHandlers() { return _userContentControllerApi.removeAllScriptMessageHandlersForInstances( this, @@ -460,14 +451,12 @@ class WKUserContentController { } /// Injects the specified script into the webpage’s content. - Future addUserScript(WKUserScript userScript) { return _userContentControllerApi.addUserScriptForInstances( this, userScript); } /// Removes all user scripts from the web view. - Future removeAllUserScripts() { return _userContentControllerApi.removeAllUserScriptsForInstances(this); } @@ -476,7 +465,6 @@ class WKUserContentController { /// A collection of properties that you use to initialize a web view. /// /// Wraps [WKWebViewConfiguration](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc). - class WKWebViewConfiguration { /// Constructs a [WKWebViewConfiguration]. factory WKWebViewConfiguration({ @@ -549,7 +537,6 @@ class WKWebViewConfiguration { /// Indicates whether HTML5 videos play inline or use the native full-screen controller. /// /// Sets [WKWebViewConfiguration.allowsInlineMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback?language=objc). - Future setAllowsInlineMediaPlayback(bool allow) { return _webViewConfigurationApi.setAllowsInlineMediaPlaybackForInstances( this, @@ -563,7 +550,6 @@ class WKWebViewConfiguration { /// required to begin playing media. /// /// Sets [WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor?language=objc). - Future setMediaTypesRequiringUserActionForPlayback( Set types, ) { @@ -579,7 +565,6 @@ class WKWebViewConfiguration { /// The methods for presenting native user interface elements on behalf of a webpage. /// /// Wraps [WKUIDelegate](https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc). - class WKUIDelegate { /// Constructs a [WKUIDelegate]. WKUIDelegate({ @@ -595,7 +580,6 @@ class WKUIDelegate { final WKUIDelegateHostApiImpl _uiDelegateApi; /// Indicates a new [WKWebView] was requested to be created with [configuration]. - Future setOnCreateWebView( void Function( WKWebViewConfiguration configuration, @@ -613,7 +597,6 @@ class WKUIDelegate { /// coordinate changes in your web view’s main frame. /// /// Wraps [WKNavigationDelegate](https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc). - class WKNavigationDelegate extends NSObject { /// Constructs a [WKNavigationDelegate]. WKNavigationDelegate({ 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 0627e58d12c1..8bf29308371e 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 @@ -47,13 +47,16 @@ Iterable _toWKWebsiteDataTypeEnumData( extension _NSHttpCookieConverter on NSHttpCookie { NSHttpCookieData toNSHttpCookieData() { + final Iterable keys = properties.keys; return NSHttpCookieData( - propertyKeys: properties.keys.map( + propertyKeys: keys.map( (NSHttpCookiePropertyKey key) { return key.toNSHttpCookiePropertyKeyEnumData(); }, ).toList(), - propertyValues: properties.values.map((_) => _).toList(), + propertyValues: keys + .map((NSHttpCookiePropertyKey key) => properties[key]!) + .toList(), ); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart index 083c5ebc702f..d684fba6f188 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart @@ -517,6 +517,9 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { Set removedJavaScriptChannels = const {}, }) async { webView.configuration.userContentController.removeAllUserScripts(); + // TODO(bparrishMines): This can be replaced with + // `removeAllScriptMessageHandlers` once Dart supports runtime version + // checking. (e.g. The equivalent to @availability in Objective-C.) _scriptMessageHandlers.keys.forEach( webView.configuration.userContentController.removeScriptMessageHandler, ); 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 021ca563fcc1..6844a5fa67ad 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -37,10 +37,10 @@ enum NSKeyValueObservingOptionsEnum { priorNotification, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class NSKeyValueObservingOptionsEnumData { - // TODO(bparrishMines): Generated code fails when enums are marked as nonnull. - // Change to nonnull once this is fixed: https://github.com/flutter/flutter/issues/100594 - late NSKeyValueObservingOptionsEnum? value; + late NSKeyValueObservingOptionsEnum value; } /// Mirror of NSKeyValueChange. @@ -53,8 +53,10 @@ enum NSKeyValueChangeEnum { replacement, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class NSKeyValueChangeEnumData { - late NSKeyValueChangeEnum? value; + late NSKeyValueChangeEnum value; } /// Mirror of NSKeyValueChangeKey. @@ -68,8 +70,10 @@ enum NSKeyValueChangeKeyEnum { oldValue, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class NSKeyValueChangeKeyEnumData { - late NSKeyValueChangeKeyEnum? value; + late NSKeyValueChangeKeyEnum value; } /// Mirror of WKUserScriptInjectionTime. @@ -80,8 +84,10 @@ enum WKUserScriptInjectionTimeEnum { atDocumentEnd, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class WKUserScriptInjectionTimeEnumData { - late WKUserScriptInjectionTimeEnum? value; + late WKUserScriptInjectionTimeEnum value; } /// Mirror of WKAudiovisualMediaTypes. @@ -94,8 +100,10 @@ enum WKAudiovisualMediaTypeEnum { all, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class WKAudiovisualMediaTypeEnumData { - late WKAudiovisualMediaTypeEnum? value; + late WKAudiovisualMediaTypeEnum value; } /// Mirror of WKWebsiteDataTypes. @@ -112,8 +120,10 @@ enum WKWebsiteDataTypeEnum { indexedDBDatabases, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class WKWebsiteDataTypeEnumData { - late WKWebsiteDataTypeEnum? value; + late WKWebsiteDataTypeEnum value; } /// Mirror of WKNavigationActionPolicy. @@ -124,8 +134,10 @@ enum WKNavigationActionPolicyEnum { cancel, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class WKNavigationActionPolicyEnumData { - late WKNavigationActionPolicyEnum? value; + late WKNavigationActionPolicyEnum value; } /// Mirror of NSHTTPCookiePropertyKey. @@ -148,8 +160,10 @@ enum NSHttpCookiePropertyKeyEnum { version, } +// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't +// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307 class NSHttpCookiePropertyKeyEnumData { - late NSHttpCookiePropertyKeyEnum? value; + late NSHttpCookiePropertyKeyEnum value; } /// Mirror of NSURLRequest. @@ -207,6 +221,8 @@ class WKScriptMessageData { /// /// See https://developer.apple.com/documentation/foundation/nshttpcookie?language=objc. class NSHttpCookieData { + // TODO(bparrishMines): Change to a map when Objective-C data classes conform + // to `NSCopying`. See https://github.com/flutter/flutter/issues/103383. // `NSDictionary`s are unable to use data classes as keys because they don't // conform to `NSCopying`. This splits the map of properties into a list of // keys and values with the ordered maintained. @@ -237,7 +253,7 @@ abstract class WKWebsiteDataStoreHostApi { bool removeDataOfTypes( int instanceId, List dataTypes, - double secondsModifiedSinceEpoch, + double modificationTimeInSecondsSinceEpoch, ); } 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 0f1f56266f75..1f963b4d9bc3 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 @@ -48,7 +48,7 @@ abstract class TestWKWebsiteDataStoreHostApi { Future removeDataOfTypes( int instanceId, List dataTypes, - double secondsModifiedSinceEpoch); + double modificationTimeInSecondsSinceEpoch); static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -114,11 +114,12 @@ abstract class TestWKWebsiteDataStoreHostApi { (args[1] as List?)?.cast(); assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); - final double? arg_secondsModifiedSinceEpoch = (args[2] as double?); - assert(arg_secondsModifiedSinceEpoch != null, + final double? arg_modificationTimeInSecondsSinceEpoch = + (args[2] as double?); + assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes( - arg_instanceId!, arg_dataTypes!, arg_secondsModifiedSinceEpoch!); + final bool output = await api.removeDataOfTypes(arg_instanceId!, + arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); return {'result': output}; }); } From 8bca3373f350687bf7fe2f0a5e74d66b5a910bb9 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 9 May 2022 23:42:11 -0700 Subject: [PATCH 22/23] cant test lower version --- .../example/ios/RunnerTests/FWFDataConvertersTests.m | 12 ------------ 1 file changed, 12 deletions(-) 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 733ee29d237f..57d90f6c6814 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 @@ -32,18 +32,6 @@ - (void)testFWFNSHTTPCookieFromCookieData { [NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"cookieName"}]); } -- (void)testFWFNSHTTPCookieFromCookieDataIgnoresSameSitePolicy { - NSHTTPCookie *cookie = FWFNSHTTPCookieFromCookieData([FWFNSHttpCookieData - makeWithPropertyKeys:@[ - [FWFNSHttpCookiePropertyKeyEnumData makeWithValue:FWFNSHttpCookiePropertyKeyEnumName], - [FWFNSHttpCookiePropertyKeyEnumData - makeWithValue:FWFNSHttpCookiePropertyKeyEnumSameSitePolicy] - ] - propertyValues:@[ @"cookieName", @"cookiePolicy" ]]); - XCTAssertEqualObjects(cookie, - [NSHTTPCookie cookieWithProperties:@{NSHTTPCookieName : @"cookieName"}]); -} - - (void)testFWFWKUserScriptFromScriptData { WKUserScript *userScript = FWFWKUserScriptFromScriptData([FWFWKUserScriptData makeWithSource:@"mySource" From 9e8854849b61c0ee60c6b43b970fc6891ca5baa5 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 10 May 2022 10:46:06 -0700 Subject: [PATCH 23/23] PR comments --- .../ios/Classes/FWFDataConverters.h | 12 ++++++------ .../ios/Classes/FWFWebViewConfigurationHostApi.m | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) 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 1f5506b5eb6c..4cf24c67ac95 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.h @@ -49,7 +49,7 @@ extern NSHTTPCookiePropertyKey _Nullable FWFNSHTTPCookiePropertyKeyFromEnumData( /** * Converts a WKUserScriptData to a WKUserScript. * - * @param data The data object containing information to create an WKUserScript. + * @param data The data object containing information to create a WKUserScript. * * @return A WKUserScript or nil if data could not be converted. */ @@ -60,17 +60,17 @@ extern WKUserScript *FWFWKUserScriptFromScriptData(FWFWKUserScriptData *data); * * @param data The data object containing information to create a WKUserScriptInjectionTime. * - * @return An WKUserScriptInjectionTime or -1 if data could not be converted. + * @return A WKUserScriptInjectionTime or -1 if data could not be converted. */ extern WKUserScriptInjectionTime FWFWKUserScriptInjectionTimeFromEnumData( FWFWKUserScriptInjectionTimeEnumData *data); /** - * Converts an FWFWKAudiovisualMediaTypeEnumData to an WKAudiovisualMediaTypes. + * Converts an FWFWKAudiovisualMediaTypeEnumData to a WKAudiovisualMediaTypes. * - * @param data The data object containing information to create an WKAudiovisualMediaTypes. + * @param data The data object containing information to create a WKAudiovisualMediaTypes. * - * @return An WKAudiovisualMediaType or -1 if data could not be converted. + * @return A WKAudiovisualMediaType or -1 if data could not be converted. */ API_AVAILABLE(ios(10.0)) extern WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData( @@ -81,7 +81,7 @@ extern WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData( * * @param data The data object containing information to create a WKWebsiteDataType. * - * @return An WKWebsiteDataType or nil if data could not be converted. + * @return A WKWebsiteDataType or nil if data could not be converted. */ extern NSString *_Nullable FWFWKWebsiteDataTypeFromEnumData(FWFWKWebsiteDataTypeEnumData *data); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m index e30abe1f9ba8..0b239daebf99 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -78,6 +78,7 @@ - (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNu case FWFWKAudiovisualMediaTypeEnumVideo: case FWFWKAudiovisualMediaTypeEnumAll: configuration.requiresUserActionForMediaPlayback = true; + break; #pragma clang diagnostic pop } }