From e6618c815ad9f350ec681944f8c1f252d4d78695 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:32:31 -0700 Subject: [PATCH 01/31] standard creation --- .../lib/src/common/instance_manager.dart | 2 - .../lib/src/foundation/foundation.dart | 30 +- .../src/foundation/foundation_api_impls.dart | 13 +- .../lib/src/ui_kit/ui_kit.dart | 72 +++- .../lib/src/ui_kit/ui_kit_api_impls.dart | 26 +- .../lib/src/web_kit/web_kit.dart | 348 ++++++++++++------ .../lib/src/web_kit/web_kit_api_impls.dart | 111 ++++-- 7 files changed, 408 insertions(+), 194 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/instance_manager.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/instance_manager.dart index c9c8c2324cc6..3cc100aebd46 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/instance_manager.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/instance_manager.dart @@ -179,8 +179,6 @@ class InstanceManager { final Copyable copy = instance.copy(); _identifiers[copy] = identifier; _strongInstances[identifier] = copy; - - assert(instance == copy); } /// Whether this manager contains the given [identifier]. 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 0a1dd347f8a2..f537a4454c4f 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 @@ -237,13 +237,12 @@ class NSHttpCookie { /// The root class of most Objective-C class hierarchies. @immutable class NSObject with Copyable { - // TODO(bparrishMines): Change constructor name to `detached`. /// Constructs a [NSObject] without creating the associated /// Objective-C object. /// /// This should only be used by subclasses created by this library or to /// create copies. - NSObject({ + NSObject.detached({ this.observeValue, BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, @@ -255,6 +254,11 @@ class NSObject with Copyable { FoundationFlutterApis.instance.ensureSetUp(); } + /// Release the reference to the Objective-C object. + static void dispose(NSObject instance) { + instance._api.instanceManager.removeWeakReference(instance); + } + /// Global instance of [InstanceManager]. static final InstanceManager globalInstanceManager = InstanceManager(onWeakReferenceRemoved: (int instanceId) { @@ -290,30 +294,12 @@ class NSObject with Copyable { return _api.removeObserverForInstances(this, observer, keyPath); } - /// Release the reference to the Objective-C object. - static void dispose(NSObject instance) { - instance._api.instanceManager.removeWeakReference(instance); - } - @override - Copyable copy() { - return NSObject( + NSObject copy() { + return NSObject.detached( observeValue: observeValue, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); } - - @override - int get hashCode { - return Object.hash(_api, _api.instanceManager.getIdentifier(this)); - } - - @override - bool operator ==(Object other) { - return other is NSObject && - _api == other._api && - _api.instanceManager.getIdentifier(this) == - other._api.instanceManager.getIdentifier(other); - } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart index f9efe3616ca7..949822006bc5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart @@ -134,21 +134,10 @@ class NSObjectHostApiImpl extends NSObjectHostApi { keyPath, ); } - - @override - int get hashCode { - return Object.hash(binaryMessenger, instanceManager); - } - - @override - bool operator ==(Object other) { - return other is NSObjectHostApiImpl && - binaryMessenger == other.binaryMessenger && - instanceManager == other.instanceManager; - } } /// Flutter api implementation for [NSObject]. +@immutable class NSObjectFlutterApiImpl extends NSObjectFlutterApi { /// Constructs a [NSObjectFlutterApiImpl]. NSObjectFlutterApiImpl({InstanceManager? instanceManager}) 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 2ed1602b9ac9..ab8c1f7caeb7 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 @@ -4,6 +4,7 @@ import 'dart:math'; +import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart' show Color; import 'package:flutter/services.dart'; @@ -12,25 +13,42 @@ import '../foundation/foundation.dart'; import '../web_kit/web_kit.dart'; import 'ui_kit_api_impls.dart'; -// TODO(bparrishMines): All subclasses of NSObject need to pass their -// InstanceManager and BinaryMessenger to its parent. They also need to -// override copy(); - /// A view that allows the scrolling and zooming of its contained views. /// /// Wraps [UIScrollView](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc). +@immutable class UIScrollView extends UIView { /// Constructs a [UIScrollView] that is owned by [webView]. - UIScrollView.fromWebView( + factory UIScrollView.fromWebView( WKWebView webView, { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - }) : _scrollViewApi = UIScrollViewHostApiImpl( + }) { + final UIScrollView scrollView = UIScrollView.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ); + scrollView._scrollViewApi.createFromWebViewForInstances( + scrollView, + webView, + ); + return scrollView; + } + + /// Constructs a [UIScrollView] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + UIScrollView.detached({ + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _scrollViewApi = UIScrollViewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ) { - _scrollViewApi.createFromWebViewForInstances(this, webView); - } + ), + super.detached(); final UIScrollViewHostApiImpl _scrollViewApi; @@ -57,21 +75,36 @@ class UIScrollView extends UIView { Future setContentOffset(Point offset) { return _scrollViewApi.setContentOffsetForInstances(this, offset); } + + @override + UIScrollView copy() { + return UIScrollView.detached( + observeValue: observeValue, + binaryMessenger: _viewApi.binaryMessenger, + instanceManager: _viewApi.instanceManager, + ); + } } /// Manages the content for a rectangular area on the screen. /// /// Wraps [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc). +@immutable class UIView extends NSObject { - /// Constructs an [NSObject]. - UIView({ + /// Constructs a [UIView] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + UIView.detached({ super.observeValue, - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _viewApi = UIViewHostApiImpl( + super.binaryMessenger, + super.instanceManager, + }) : _viewApi = UIViewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); + ), + super.detached(); final UIViewHostApiImpl _viewApi; @@ -90,4 +123,13 @@ class UIView extends NSObject { Future setOpaque(bool opaque) { return _viewApi.setOpaqueForInstances(this, opaque); } + + @override + UIView copy() { + return UIView.detached( + observeValue: observeValue, + binaryMessenger: _viewApi.binaryMessenger, + instanceManager: _viewApi.instanceManager, + ); + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart index e921c4bad15a..c9f50c5d808c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart @@ -5,7 +5,9 @@ import 'dart:async'; import 'dart:math'; +import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart' show Color; +import 'package:flutter/services.dart'; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart'; @@ -15,12 +17,20 @@ import '../web_kit/web_kit.dart'; import 'ui_kit.dart'; /// Host api implementation for [UIScrollView]. +@immutable class UIScrollViewHostApiImpl extends UIScrollViewHostApi { /// Constructs a [UIScrollViewHostApiImpl]. UIScrollViewHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -72,12 +82,20 @@ class UIScrollViewHostApiImpl extends UIScrollViewHostApi { } /// Host api implementation for [UIView]. +@immutable class UIViewHostApiImpl extends UIViewHostApi { /// Constructs a [UIViewHostApiImpl]. UIViewHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; 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 b2945293e624..36dc8c6ddac0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart @@ -10,10 +10,6 @@ import '../foundation/foundation.dart'; import '../ui_kit/ui_kit.dart'; import 'web_kit_api_impls.dart'; -// TODO(bparrishMines): All subclasses of NSObject need to pass their -// InstanceManager and BinaryMessenger to its parent. They also need to -// override copy(): https://github.com/flutter/flutter/issues/105245 - /// Times at which to inject script content into a webpage. /// /// Wraps [WKUserScriptInjectionTime](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc). @@ -214,23 +210,40 @@ class WKScriptMessage { /// Encapsulates the standard behaviors to apply to websites. /// /// Wraps [WKPreferences](https://developer.apple.com/documentation/webkit/wkpreferences?language=objc). +@immutable class WKPreferences extends NSObject { /// Constructs a [WKPreferences] that is owned by [configuration]. - @visibleForTesting - WKPreferences.fromWebViewConfiguration( + factory WKPreferences.fromWebViewConfiguration( WKWebViewConfiguration configuration, { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - }) : _preferencesApi = WKPreferencesHostApiImpl( - binaryMessenger: binaryMessenger, - instanceManager: instanceManager, - ) { - _preferencesApi.createFromWebViewConfigurationForInstances( - this, + }) { + final WKPreferences preferences = WKPreferences.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ); + preferences._preferencesApi.createFromWebViewConfigurationForInstances( + preferences, configuration, ); + return preferences; } + /// Constructs a [WKPreferences] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + WKPreferences.detached({ + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _preferencesApi = WKPreferencesHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + final WKPreferencesHostApiImpl _preferencesApi; // TODO(bparrishMines): Deprecated for iOS 14.0+. Add support for alternative. @@ -240,22 +253,39 @@ class WKPreferences extends NSObject { Future setJavaScriptEnabled(bool enabled) { return _preferencesApi.setJavaScriptEnabledForInstances(this, enabled); } + + @override + WKPreferences copy() { + return WKPreferences.detached( + observeValue: observeValue, + binaryMessenger: _preferencesApi.binaryMessenger, + instanceManager: _preferencesApi.instanceManager, + ); + } } /// 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). +@immutable class WKWebsiteDataStore extends NSObject { - WKWebsiteDataStore._({ - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _websiteDataStoreApi = WKWebsiteDataStoreHostApiImpl( + /// Constructs a [WKWebsiteDataStore] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + WKWebsiteDataStore.detached({ + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _websiteDataStoreApi = WKWebsiteDataStoreHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); + ), + super.detached(); factory WKWebsiteDataStore._defaultDataStore() { - final WKWebsiteDataStore websiteDataStore = WKWebsiteDataStore._(); + final WKWebsiteDataStore websiteDataStore = WKWebsiteDataStore.detached(); websiteDataStore._websiteDataStoreApi.createDefaultDataStoreForInstances( websiteDataStore, ); @@ -263,13 +293,12 @@ class WKWebsiteDataStore extends NSObject { } /// Constructs a [WKWebsiteDataStore] that is owned by [configuration]. - @visibleForTesting factory WKWebsiteDataStore.fromWebViewConfiguration( WKWebViewConfiguration configuration, { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, }) { - final WKWebsiteDataStore websiteDataStore = WKWebsiteDataStore._( + final WKWebsiteDataStore websiteDataStore = WKWebsiteDataStore.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, ); @@ -304,28 +333,44 @@ class WKWebsiteDataStore extends NSObject { secondsModifiedSinceEpoch: since.millisecondsSinceEpoch / 1000, ); } + + @override + WKWebsiteDataStore copy() { + return WKWebsiteDataStore.detached( + observeValue: observeValue, + binaryMessenger: _websiteDataStoreApi.binaryMessenger, + instanceManager: _websiteDataStoreApi.instanceManager, + ); + } } /// An object that manages the HTTP cookies associated with a particular web view. /// /// Wraps [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc). +@immutable class WKHttpCookieStore extends NSObject { - WKHttpCookieStore._({ - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _httpCookieStoreApi = WKHttpCookieStoreHostApiImpl( + /// Constructs a [WKHttpCookieStore] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + WKHttpCookieStore.detached({ + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _httpCookieStoreApi = WKHttpCookieStoreHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); + ), + super.detached(); /// Constructs a [WKHttpCookieStore] that is owned by [dataStore]. - @visibleForTesting factory WKHttpCookieStore.fromWebsiteDataStore( WKWebsiteDataStore dataStore, { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, }) { - final WKHttpCookieStore cookieStore = WKHttpCookieStore._( + final WKHttpCookieStore cookieStore = WKHttpCookieStore.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, ); @@ -342,25 +387,52 @@ class WKHttpCookieStore extends NSObject { Future setCookie(NSHttpCookie cookie) { return _httpCookieStoreApi.setCookieForInsances(this, cookie); } + + @override + WKHttpCookieStore copy() { + return WKHttpCookieStore.detached( + observeValue: observeValue, + binaryMessenger: _httpCookieStoreApi.binaryMessenger, + instanceManager: _httpCookieStoreApi.instanceManager, + ); + } } /// An interface for receiving messages from JavaScript code running in a webpage. /// -/// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc) +/// Wraps [WKScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc). +@immutable class WKScriptMessageHandler extends NSObject { /// Constructs a [WKScriptMessageHandler]. WKScriptMessageHandler({ required this.didReceiveScriptMessage, super.observeValue, - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _scriptMessageHandlerApi = WKScriptMessageHandlerHostApiImpl( + super.binaryMessenger, + super.instanceManager, + }) : _scriptMessageHandlerApi = WKScriptMessageHandlerHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ) { + ), + super.detached() { _scriptMessageHandlerApi.createForInstances(this); } + /// Constructs a [WKScriptMessageHandler] without creating the associated + /// Objective-C object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + WKScriptMessageHandler.detached({ + required this.didReceiveScriptMessage, + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _scriptMessageHandlerApi = WKScriptMessageHandlerHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + final WKScriptMessageHandlerHostApiImpl _scriptMessageHandlerApi; /// Tells the handler that a webpage sent a script message. @@ -372,6 +444,16 @@ class WKScriptMessageHandler extends NSObject { WKUserContentController userContentController, WKScriptMessage message, ) didReceiveScriptMessage; + + @override + WKScriptMessageHandler copy() { + return WKScriptMessageHandler.detached( + didReceiveScriptMessage: didReceiveScriptMessage, + observeValue: observeValue, + binaryMessenger: _scriptMessageHandlerApi.binaryMessenger, + instanceManager: _scriptMessageHandlerApi.instanceManager, + ); + } } /// Manages interactions between JavaScript code and your web view. @@ -383,21 +465,25 @@ class WKScriptMessageHandler extends NSObject { /// code. /// /// Wraps [WKUserContentController](https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc). +@immutable class WKUserContentController extends NSObject { /// Constructs a [WKUserContentController] that is owned by [configuration]. - @visibleForTesting - WKUserContentController.fromWebViewConfiguration( + factory WKUserContentController.fromWebViewConfiguration( WKWebViewConfiguration configuration, { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - }) : _userContentControllerApi = WKUserContentControllerHostApiImpl( - binaryMessenger: binaryMessenger, - instanceManager: instanceManager, - ) { - _userContentControllerApi.createFromWebViewConfigurationForInstances( - this, + }) { + final WKUserContentController userContentController = + WKUserContentController.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ); + userContentController._userContentControllerApi + .createFromWebViewConfigurationForInstances( + userContentController, configuration, ); + return userContentController; } /// Constructs a [WKUserContentController] without creating the associated @@ -406,12 +492,14 @@ class WKUserContentController extends NSObject { /// This should only be used outside of tests by subclasses created by this /// library or to create a copy for an InstanceManager. WKUserContentController.detached({ - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _userContentControllerApi = WKUserContentControllerHostApiImpl( + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _userContentControllerApi = WKUserContentControllerHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); + ), + super.detached(); final WKUserContentControllerHostApiImpl _userContentControllerApi; @@ -474,24 +562,33 @@ class WKUserContentController extends NSObject { Future removeAllUserScripts() { return _userContentControllerApi.removeAllUserScriptsForInstances(this); } + + @override + WKUserContentController copy() { + return WKUserContentController.detached( + observeValue: observeValue, + binaryMessenger: _userContentControllerApi.binaryMessenger, + instanceManager: _userContentControllerApi.instanceManager, + ); + } } /// A collection of properties that you use to initialize a web view. /// /// Wraps [WKWebViewConfiguration](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc). +@immutable class WKWebViewConfiguration extends NSObject { /// Constructs a [WKWebViewConfiguration]. - factory WKWebViewConfiguration({ - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) { - final WKWebViewConfiguration configuration = - WKWebViewConfiguration.detached( - binaryMessenger: binaryMessenger, - instanceManager: instanceManager, - ); - configuration._webViewConfigurationApi.createForInstances(configuration); - return configuration; + WKWebViewConfiguration({ + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _webViewConfigurationApi = WKWebViewConfigurationHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached() { + _webViewConfigurationApi.createForInstances(this); } /// A WKWebViewConfiguration that is owned by webView. @@ -519,17 +616,14 @@ class WKWebViewConfiguration extends NSObject { /// This should only be used outside of tests by subclasses created by this /// library or to create a copy for an InstanceManager. WKWebViewConfiguration.detached({ - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _binaryMessenger = binaryMessenger, - _instanceManager = instanceManager, - _webViewConfigurationApi = WKWebViewConfigurationHostApiImpl( + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _webViewConfigurationApi = WKWebViewConfigurationHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); - - final BinaryMessenger? _binaryMessenger; - final InstanceManager? _instanceManager; + ), + super.detached(); late final WKWebViewConfigurationHostApiImpl _webViewConfigurationApi; @@ -537,13 +631,16 @@ class WKWebViewConfiguration extends NSObject { late final WKUserContentController userContentController = WKUserContentController.fromWebViewConfiguration( this, - binaryMessenger: _binaryMessenger, - instanceManager: _instanceManager, + binaryMessenger: _webViewConfigurationApi.binaryMessenger, + instanceManager: _webViewConfigurationApi.instanceManager, ); /// Manages the preference-related settings for the web view. - late final WKPreferences preferences = - WKPreferences.fromWebViewConfiguration(this); + late final WKPreferences preferences = WKPreferences.fromWebViewConfiguration( + this, + binaryMessenger: _webViewConfigurationApi.binaryMessenger, + instanceManager: _webViewConfigurationApi.instanceManager, + ); /// Used to get and set the site’s cookies and to track the cached data objects. /// @@ -551,8 +648,8 @@ class WKWebViewConfiguration extends NSObject { late final WKWebsiteDataStore websiteDataStore = WKWebsiteDataStore.fromWebViewConfiguration( this, - binaryMessenger: _binaryMessenger, - instanceManager: _instanceManager, + binaryMessenger: _webViewConfigurationApi.binaryMessenger, + instanceManager: _webViewConfigurationApi.instanceManager, ); /// Indicates whether HTML5 videos play inline or use the native full-screen controller. @@ -581,25 +678,52 @@ class WKWebViewConfiguration extends NSObject { types, ); } + + @override + WKWebViewConfiguration copy() { + return WKWebViewConfiguration.detached( + observeValue: observeValue, + binaryMessenger: _webViewConfigurationApi.binaryMessenger, + instanceManager: _webViewConfigurationApi.instanceManager, + ); + } } /// The methods for presenting native user interface elements on behalf of a webpage. /// /// Wraps [WKUIDelegate](https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc). +@immutable class WKUIDelegate extends NSObject { /// Constructs a [WKUIDelegate]. WKUIDelegate({ this.onCreateWebView, super.observeValue, - BinaryMessenger? binaryMessenger, - InstanceManager? instanceManager, - }) : _uiDelegateApi = WKUIDelegateHostApiImpl( + super.binaryMessenger, + super.instanceManager, + }) : _uiDelegateApi = WKUIDelegateHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ) { + ), + super.detached() { _uiDelegateApi.createForInstances(this); } + /// Constructs a [WKUIDelegate] without creating the associated Objective-C + /// object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies. + WKUIDelegate.detached({ + this.onCreateWebView, + super.observeValue, + super.binaryMessenger, + super.instanceManager, + }) : _uiDelegateApi = WKUIDelegateHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + final WKUIDelegateHostApiImpl _uiDelegateApi; /// Indicates a new [WKWebView] was requested to be created with [configuration]. @@ -608,6 +732,16 @@ class WKUIDelegate extends NSObject { WKWebViewConfiguration configuration, WKNavigationAction navigationAction, )? onCreateWebView; + + @override + WKUIDelegate copy() { + return WKUIDelegate.detached( + onCreateWebView: onCreateWebView, + observeValue: observeValue, + binaryMessenger: _uiDelegateApi.binaryMessenger, + instanceManager: _uiDelegateApi.instanceManager, + ); + } } /// Methods for handling navigation changes and tracking navigation requests. @@ -629,10 +763,11 @@ class WKNavigationDelegate extends NSObject { super.observeValue, super.binaryMessenger, super.instanceManager, - }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl( + }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ) { + ), + super.detached() { WebKitFlutterApis.instance.ensureSetUp(); _navigationDelegateApi.createForInstances(this); } @@ -652,10 +787,11 @@ class WKNavigationDelegate extends NSObject { super.observeValue, super.binaryMessenger, super.instanceManager, - }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl( + }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); + ), + super.detached(); final WKNavigationDelegateHostApiImpl _navigationDelegateApi; @@ -683,7 +819,7 @@ class WKNavigationDelegate extends NSObject { final void Function(WKWebView webView)? webViewWebContentProcessDidTerminate; @override - Copyable copy() { + WKNavigationDelegate copy() { return WKNavigationDelegate.detached( didFinishNavigation: didFinishNavigation, didStartProvisionalNavigation: didStartProvisionalNavigation, @@ -697,26 +833,12 @@ class WKNavigationDelegate extends NSObject { instanceManager: _navigationDelegateApi.instanceManager, ); } - - @override - int get hashCode { - return Object.hash(didFinishNavigation, _navigationDelegateApi, - _navigationDelegateApi.instanceManager.getIdentifier(this)); - } - - @override - bool operator ==(Object other) { - return other is WKNavigationDelegate && - didFinishNavigation == other.didFinishNavigation && - _navigationDelegateApi == other._navigationDelegateApi && - _navigationDelegateApi.instanceManager.getIdentifier(this) == - other._navigationDelegateApi.instanceManager.getIdentifier(other); - } } /// Object that displays interactive web content, such as for an in-app browser. /// /// Wraps [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview?language=objc). +@immutable class WKWebView extends UIView { /// Constructs a [WKWebView]. /// @@ -732,17 +854,16 @@ class WKWebView extends UIView { super.observeValue, super.binaryMessenger, super.instanceManager, - }) : _binaryMessenger = binaryMessenger, - _instanceManager = instanceManager, - _webViewApi = WKWebViewHostApiImpl( + }) : _webViewApi = WKWebViewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ) { + ), + super.detached() { _webViewApi.createForInstances(this, configuration); } - /// Constructs a [WKWebView] without creating the associated - /// Objective-C object. + /// Constructs a [WKWebView] without creating the associated Objective-C + /// object. /// /// This should only be used outside of tests by subclasses created by this /// library or to create a copy for an InstanceManager. @@ -750,15 +871,11 @@ class WKWebView extends UIView { super.observeValue, super.binaryMessenger, super.instanceManager, - }) : _binaryMessenger = binaryMessenger, - _instanceManager = instanceManager, - _webViewApi = WKWebViewHostApiImpl( + }) : _webViewApi = WKWebViewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - ); - - final BinaryMessenger? _binaryMessenger; - final InstanceManager? _instanceManager; + ), + super.detached(); final WKWebViewHostApiImpl _webViewApi; @@ -774,15 +891,15 @@ class WKWebView extends UIView { late final WKWebViewConfiguration configuration = WKWebViewConfiguration.fromWebView( this, - binaryMessenger: _binaryMessenger, - instanceManager: _instanceManager, + binaryMessenger: _webViewApi.binaryMessenger, + instanceManager: _webViewApi.instanceManager, ); /// The scrollable view associated with the web view. late final UIScrollView scrollView = UIScrollView.fromWebView( this, - binaryMessenger: _binaryMessenger, - instanceManager: _instanceManager, + binaryMessenger: _webViewApi.binaryMessenger, + instanceManager: _webViewApi.instanceManager, ); /// Used to integrate custom user interface elements into web view interactions. @@ -904,4 +1021,13 @@ class WKWebView extends UIView { javaScriptString, ); } + + @override + WKWebView copy() { + return WKWebView.detached( + observeValue: observeValue, + binaryMessenger: _webViewApi.binaryMessenger, + instanceManager: _webViewApi.instanceManager, + ); + } } 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 c27fc3e73aee..f59372b7debe 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 @@ -293,12 +293,20 @@ class WebKitFlutterApis { } /// Host api implementation for [WKWebSiteDataStore]. +@immutable class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { /// Constructs a [WebsiteDataStoreHostApiImpl]. WKWebsiteDataStoreHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -338,12 +346,20 @@ class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { } /// Host api implementation for [WKScriptMessageHandler]. +@immutable class WKScriptMessageHandlerHostApiImpl extends WKScriptMessageHandlerHostApi { /// Constructs a [WKScriptMessageHandlerHostApiImpl]. WKScriptMessageHandlerHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -355,6 +371,7 @@ class WKScriptMessageHandlerHostApiImpl extends WKScriptMessageHandlerHostApi { } /// Flutter api implementation for [WKScriptMessageHandler]. +@immutable class WKScriptMessageHandlerFlutterApiImpl extends WKScriptMessageHandlerFlutterApi { /// Constructs a [WKScriptMessageHandlerFlutterApiImpl]. @@ -384,12 +401,20 @@ class WKScriptMessageHandlerFlutterApiImpl } /// Host api implementation for [WKPreferences]. +@immutable class WKPreferencesHostApiImpl extends WKPreferencesHostApi { /// Constructs a [WKPreferencesHostApiImpl]. WKPreferencesHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -418,12 +443,20 @@ class WKPreferencesHostApiImpl extends WKPreferencesHostApi { } /// Host api implementation for [WKHttpCookieStore]. +@immutable class WKHttpCookieStoreHostApiImpl extends WKHttpCookieStoreHostApi { /// Constructs a [WKHttpCookieStoreHostApiImpl]. WKHttpCookieStoreHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -452,13 +485,21 @@ class WKHttpCookieStoreHostApiImpl extends WKHttpCookieStoreHostApi { } /// Host api implementation for [WKUserContentController]. +@immutable class WKUserContentControllerHostApiImpl extends WKUserContentControllerHostApi { /// Constructs a [WKUserContentControllerHostApiImpl]. WKUserContentControllerHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -527,12 +568,20 @@ class WKUserContentControllerHostApiImpl } /// Host api implementation for [WKWebViewConfiguration]. +@immutable class WKWebViewConfigurationHostApiImpl extends WKWebViewConfigurationHostApi { /// Constructs a [WKWebViewConfigurationHostApiImpl]. WKWebViewConfigurationHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -577,12 +626,20 @@ class WKWebViewConfigurationHostApiImpl extends WKWebViewConfigurationHostApi { } /// Host api implementation for [WKUIDelegate]. +@immutable class WKUIDelegateHostApiImpl extends WKUIDelegateHostApi { /// Constructs a [WKUIDelegateHostApiImpl]. WKUIDelegateHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; @@ -594,6 +651,7 @@ class WKUIDelegateHostApiImpl extends WKUIDelegateHostApi { } /// Flutter api implementation for [WKUIDelegate]. +@immutable class WKUIDelegateFlutterApiImpl extends WKUIDelegateFlutterApi { /// Constructs a [WKUIDelegateFlutterApiImpl]. WKUIDelegateFlutterApiImpl({InstanceManager? instanceManager}) @@ -648,21 +706,10 @@ class WKNavigationDelegateHostApiImpl extends WKNavigationDelegateHostApi { Future createForInstances(WKNavigationDelegate instance) async { return create(instanceManager.addDartCreatedInstance(instance)); } - - @override - int get hashCode { - return Object.hash(binaryMessenger, instanceManager); - } - - @override - bool operator ==(Object other) { - return other is WKNavigationDelegateHostApiImpl && - binaryMessenger == other.binaryMessenger && - instanceManager == other.instanceManager; - } } /// Flutter api implementation for [WKNavigationDelegate]. +@immutable class WKNavigationDelegateFlutterApiImpl extends WKNavigationDelegateFlutterApi { /// Constructs a [WKNavigationDelegateFlutterApiImpl]. @@ -776,12 +823,20 @@ class WKNavigationDelegateFlutterApiImpl } /// Host api implementation for [WKWebView]. +@immutable class WKWebViewHostApiImpl extends WKWebViewHostApi { /// Constructs a [WKWebViewHostApiImpl]. WKWebViewHostApiImpl({ - super.binaryMessenger, + this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; /// Maintains instances stored to communicate with Objective-C objects. final InstanceManager instanceManager; From 1bd8ca307be3dfc5c62958af59154588bcedbab4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:34:12 -0700 Subject: [PATCH 02/31] fix tests --- .../test/src/foundation/foundation_test.dart | 16 +++++++++++----- .../test/src/ui_kit/ui_kit_test.dart | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart index 8d15d65f3598..2047b700221f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart @@ -37,7 +37,7 @@ void main() { mockPlatformHostApi = MockTestNSObjectHostApi(); TestNSObjectHostApi.setup(mockPlatformHostApi); - object = NSObject(instanceManager: instanceManager); + object = NSObject.detached(instanceManager: instanceManager); instanceManager.addDartCreatedInstance(object); }); @@ -46,7 +46,9 @@ void main() { }); test('addObserver', () async { - final NSObject observer = NSObject(instanceManager: instanceManager); + final NSObject observer = NSObject.detached( + instanceManager: instanceManager, + ); instanceManager.addDartCreatedInstance(observer); await object.addObserver( @@ -78,7 +80,9 @@ void main() { }); test('removeObserver', () async { - final NSObject observer = NSObject(instanceManager: instanceManager); + final NSObject observer = NSObject.detached( + instanceManager: instanceManager, + ); instanceManager.addDartCreatedInstance(observer); await object.removeObserver(observer, keyPath: 'aKeyPath'); @@ -97,7 +101,9 @@ void main() { callbackIdentifier = identifier; }); - final NSObject object = NSObject(instanceManager: instanceManager); + final NSObject object = NSObject.detached( + instanceManager: instanceManager, + ); final int identifier = instanceManager.addDartCreatedInstance(object); NSObject.dispose(object); @@ -112,7 +118,7 @@ void main() { instanceManager: instanceManager, ); - object = NSObject( + object = NSObject.detached( instanceManager: instanceManager, observeValue: ( String keyPath, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart index aeb4e1cc54ce..f2250e1ac423 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart @@ -97,7 +97,7 @@ void main() { mockPlatformHostApi = MockTestUIViewHostApi(); TestUIViewHostApi.setup(mockPlatformHostApi); - view = UIView(instanceManager: instanceManager); + view = UIView.detached(instanceManager: instanceManager); viewInstanceId = instanceManager.addDartCreatedInstance(view); }); From 6d67ecd1c969f523babafea5fe7bd2a6183d12a3 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 14:03:50 -0700 Subject: [PATCH 03/31] update mocks --- .../web_kit_cookie_manager_test.mocks.dart | 69 ++-- .../web_kit_webview_widget_test.mocks.dart | 388 +++++++++--------- 2 files changed, 236 insertions(+), 221 deletions(-) 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 8289831fc4e4..fbae3262d2fa 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 @@ -2,14 +2,12 @@ // in webview_flutter_wkwebview/test/src/web_kit_cookie_manager_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/instance_manager.dart' - as _i2; import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' - as _i5; -import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i3; + as _i4; +import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i2; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -21,77 +19,82 @@ import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i3; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types -class _FakeCopyable_0 extends _i1.Fake implements _i2.Copyable {} +class _FakeWKHttpCookieStore_0 extends _i1.Fake + implements _i2.WKHttpCookieStore {} -class _FakeWKHttpCookieStore_1 extends _i1.Fake - implements _i3.WKHttpCookieStore {} +class _FakeWKWebsiteDataStore_1 extends _i1.Fake + implements _i2.WKWebsiteDataStore {} /// A class which mocks [WKHttpCookieStore]. /// /// See the documentation for Mockito's code generation for more information. -class MockWKHttpCookieStore extends _i1.Mock implements _i3.WKHttpCookieStore { +// ignore: must_be_immutable +class MockWKHttpCookieStore extends _i1.Mock implements _i2.WKHttpCookieStore { MockWKHttpCookieStore() { _i1.throwOnMissingStub(this); } @override - _i4.Future setCookie(_i5.NSHttpCookie? cookie) => + _i3.Future setCookie(_i4.NSHttpCookie? cookie) => (super.noSuchMethod(Invocation.method(#setCookie, [cookie]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + returnValueForMissingStub: Future.value()) as _i3.Future); @override - _i4.Future addObserver(_i5.NSObject? observer, - {String? keyPath, Set<_i5.NSKeyValueObservingOptions>? options}) => + _i2.WKHttpCookieStore copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKHttpCookieStore_0()) as _i2.WKHttpCookieStore); + @override + _i3.Future addObserver(_i4.NSObject? observer, + {String? keyPath, Set<_i4.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + returnValueForMissingStub: Future.value()) as _i3.Future); @override - _i4.Future removeObserver(_i5.NSObject? observer, {String? keyPath}) => + _i3.Future removeObserver(_i4.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i2.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_0()) as _i2.Copyable); + returnValueForMissingStub: Future.value()) as _i3.Future); } /// A class which mocks [WKWebsiteDataStore]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKWebsiteDataStore extends _i1.Mock - implements _i3.WKWebsiteDataStore { + implements _i2.WKWebsiteDataStore { MockWKWebsiteDataStore() { _i1.throwOnMissingStub(this); } @override - _i3.WKHttpCookieStore get httpCookieStore => + _i2.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod(Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHttpCookieStore_1()) as _i3.WKHttpCookieStore); + returnValue: _FakeWKHttpCookieStore_0()) as _i2.WKHttpCookieStore); @override - _i4.Future removeDataOfTypes( - Set<_i3.WKWebsiteDataType>? dataTypes, DateTime? since) => + _i3.Future removeDataOfTypes( + Set<_i2.WKWebsiteDataType>? dataTypes, DateTime? since) => (super.noSuchMethod( Invocation.method(#removeDataOfTypes, [dataTypes, since]), - returnValue: Future.value(false)) as _i4.Future); + returnValue: Future.value(false)) as _i3.Future); @override - _i4.Future addObserver(_i5.NSObject? observer, - {String? keyPath, Set<_i5.NSKeyValueObservingOptions>? options}) => + _i2.WKWebsiteDataStore copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKWebsiteDataStore_1()) as _i2.WKWebsiteDataStore); + @override + _i3.Future addObserver(_i4.NSObject? observer, + {String? keyPath, Set<_i4.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + returnValueForMissingStub: Future.value()) as _i3.Future); @override - _i4.Future removeObserver(_i5.NSObject? observer, {String? keyPath}) => + _i3.Future removeObserver(_i4.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i2.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_0()) as _i2.Copyable); + returnValueForMissingStub: Future.value()) as _i3.Future); } 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 c8ed4c856dcb..222d968ed9fa 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 @@ -2,25 +2,23 @@ // in webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart. // Do not manually edit this file. -import 'dart:async' as _i6; +import 'dart:async' as _i5; import 'dart:math' as _i2; -import 'dart:ui' as _i7; +import 'dart:ui' as _i6; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_platform_interface/src/types/javascript_channel.dart' - as _i10; + as _i9; import 'package:webview_flutter_platform_interface/src/types/types.dart' - as _i11; + as _i10; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' - as _i9; -import 'package:webview_flutter_wkwebview/src/common/instance_manager.dart' - as _i3; -import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' as _i8; -import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i5; +import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart' + as _i7; +import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i3; import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4; import 'package:webview_flutter_wkwebview/src/web_kit_webview_widget.dart' - as _i12; + as _i11; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -34,84 +32,83 @@ import 'package:webview_flutter_wkwebview/src/web_kit_webview_widget.dart' class _FakePoint_0 extends _i1.Fake implements _i2.Point {} -class _FakeCopyable_1 extends _i1.Fake implements _i3.Copyable {} +class _FakeUIScrollView_1 extends _i1.Fake implements _i3.UIScrollView {} + +class _FakeWKNavigationDelegate_2 extends _i1.Fake + implements _i4.WKNavigationDelegate {} + +class _FakeWKPreferences_3 extends _i1.Fake implements _i4.WKPreferences {} -class _FakeWKWebViewConfiguration_2 extends _i1.Fake +class _FakeWKScriptMessageHandler_4 extends _i1.Fake + implements _i4.WKScriptMessageHandler {} + +class _FakeWKWebViewConfiguration_5 extends _i1.Fake implements _i4.WKWebViewConfiguration {} -class _FakeUIScrollView_3 extends _i1.Fake implements _i5.UIScrollView {} +class _FakeWKWebView_6 extends _i1.Fake implements _i4.WKWebView {} -class _FakeWKUserContentController_4 extends _i1.Fake +class _FakeWKUserContentController_7 extends _i1.Fake implements _i4.WKUserContentController {} -class _FakeWKPreferences_5 extends _i1.Fake implements _i4.WKPreferences {} - -class _FakeWKWebsiteDataStore_6 extends _i1.Fake +class _FakeWKWebsiteDataStore_8 extends _i1.Fake implements _i4.WKWebsiteDataStore {} -class _FakeWKHttpCookieStore_7 extends _i1.Fake +class _FakeWKHttpCookieStore_9 extends _i1.Fake implements _i4.WKHttpCookieStore {} -class _FakeWKWebView_8 extends _i1.Fake implements _i4.WKWebView {} - -class _FakeWKScriptMessageHandler_9 extends _i1.Fake - implements _i4.WKScriptMessageHandler {} - class _FakeWKUIDelegate_10 extends _i1.Fake implements _i4.WKUIDelegate {} -class _FakeWKNavigationDelegate_11 extends _i1.Fake - implements _i4.WKNavigationDelegate {} - /// A class which mocks [UIScrollView]. /// /// See the documentation for Mockito's code generation for more information. -class MockUIScrollView extends _i1.Mock implements _i5.UIScrollView { +// ignore: must_be_immutable +class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView { MockUIScrollView() { _i1.throwOnMissingStub(this); } @override - _i6.Future<_i2.Point> getContentOffset() => (super.noSuchMethod( + _i5.Future<_i2.Point> getContentOffset() => (super.noSuchMethod( Invocation.method(#getContentOffset, []), returnValue: Future<_i2.Point>.value(_FakePoint_0())) - as _i6.Future<_i2.Point>); + as _i5.Future<_i2.Point>); @override - _i6.Future scrollBy(_i2.Point? offset) => + _i5.Future scrollBy(_i2.Point? offset) => (super.noSuchMethod(Invocation.method(#scrollBy, [offset]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setContentOffset(_i2.Point? offset) => + _i5.Future setContentOffset(_i2.Point? offset) => (super.noSuchMethod(Invocation.method(#setContentOffset, [offset]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i3.UIScrollView copy() => (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeUIScrollView_1()) as _i3.UIScrollView); @override - _i6.Future setBackgroundColor(_i7.Color? color) => + _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod(Invocation.method(#setBackgroundColor, [color]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setOpaque(bool? opaque) => + _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod(Invocation.method(#setOpaque, [opaque]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKNavigationDelegate]. @@ -125,59 +122,62 @@ class MockWKNavigationDelegate extends _i1.Mock } @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + _i4.WKNavigationDelegate copy() => (super.noSuchMethod( + Invocation.method(#copy, []), + returnValue: _FakeWKNavigationDelegate_2()) as _i4.WKNavigationDelegate); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKPreferences]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences { MockWKPreferences() { _i1.throwOnMissingStub(this); } @override - _i6.Future setJavaScriptEnabled(bool? enabled) => + _i5.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod(Invocation.method(#setJavaScriptEnabled, [enabled]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i4.WKPreferences copy() => (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKPreferences_3()) as _i4.WKPreferences); + @override + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKScriptMessageHandler]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKScriptMessageHandler extends _i1.Mock implements _i4.WKScriptMessageHandler { MockWKScriptMessageHandler() { @@ -192,27 +192,30 @@ class MockWKScriptMessageHandler extends _i1.Mock _i4.WKScriptMessage message) {}) as void Function( _i4.WKUserContentController, _i4.WKScriptMessage)); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i4.WKScriptMessageHandler copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKScriptMessageHandler_4()) + as _i4.WKScriptMessageHandler); + @override + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKWebView]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKWebView extends _i1.Mock implements _i4.WKWebView { MockWKWebView() { _i1.throwOnMissingStub(this); @@ -221,127 +224,128 @@ class MockWKWebView extends _i1.Mock implements _i4.WKWebView { @override _i4.WKWebViewConfiguration get configuration => (super.noSuchMethod(Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_2()) + returnValue: _FakeWKWebViewConfiguration_5()) as _i4.WKWebViewConfiguration); @override - _i5.UIScrollView get scrollView => + _i3.UIScrollView get scrollView => (super.noSuchMethod(Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_3()) as _i5.UIScrollView); + returnValue: _FakeUIScrollView_1()) as _i3.UIScrollView); @override - _i6.Future setUIDelegate(_i4.WKUIDelegate? delegate) => + _i5.Future setUIDelegate(_i4.WKUIDelegate? delegate) => (super.noSuchMethod(Invocation.method(#setUIDelegate, [delegate]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setNavigationDelegate(_i4.WKNavigationDelegate? delegate) => + _i5.Future setNavigationDelegate(_i4.WKNavigationDelegate? delegate) => (super.noSuchMethod(Invocation.method(#setNavigationDelegate, [delegate]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future getUrl() => + _i5.Future getUrl() => (super.noSuchMethod(Invocation.method(#getUrl, []), - returnValue: Future.value()) as _i6.Future); + returnValue: Future.value()) as _i5.Future); @override - _i6.Future getEstimatedProgress() => + _i5.Future getEstimatedProgress() => (super.noSuchMethod(Invocation.method(#getEstimatedProgress, []), - returnValue: Future.value(0.0)) as _i6.Future); + returnValue: Future.value(0.0)) as _i5.Future); @override - _i6.Future loadRequest(_i8.NSUrlRequest? request) => + _i5.Future loadRequest(_i7.NSUrlRequest? request) => (super.noSuchMethod(Invocation.method(#loadRequest, [request]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future loadHtmlString(String? string, {String? baseUrl}) => + _i5.Future loadHtmlString(String? string, {String? baseUrl}) => (super.noSuchMethod( Invocation.method(#loadHtmlString, [string], {#baseUrl: baseUrl}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future loadFileUrl(String? url, {String? readAccessUrl}) => + _i5.Future loadFileUrl(String? url, {String? readAccessUrl}) => (super.noSuchMethod( Invocation.method( #loadFileUrl, [url], {#readAccessUrl: readAccessUrl}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future loadFlutterAsset(String? key) => + _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod(Invocation.method(#loadFlutterAsset, [key]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future canGoBack() => + _i5.Future canGoBack() => (super.noSuchMethod(Invocation.method(#canGoBack, []), - returnValue: Future.value(false)) as _i6.Future); + returnValue: Future.value(false)) as _i5.Future); @override - _i6.Future canGoForward() => + _i5.Future canGoForward() => (super.noSuchMethod(Invocation.method(#canGoForward, []), - returnValue: Future.value(false)) as _i6.Future); + returnValue: Future.value(false)) as _i5.Future); @override - _i6.Future goBack() => + _i5.Future goBack() => (super.noSuchMethod(Invocation.method(#goBack, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future goForward() => + _i5.Future goForward() => (super.noSuchMethod(Invocation.method(#goForward, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future reload() => + _i5.Future reload() => (super.noSuchMethod(Invocation.method(#reload, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future getTitle() => + _i5.Future getTitle() => (super.noSuchMethod(Invocation.method(#getTitle, []), - returnValue: Future.value()) as _i6.Future); + returnValue: Future.value()) as _i5.Future); @override - _i6.Future setAllowsBackForwardNavigationGestures(bool? allow) => + _i5.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setCustomUserAgent(String? userAgent) => + _i5.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod(Invocation.method(#setCustomUserAgent, [userAgent]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future evaluateJavaScript(String? javaScriptString) => (super + _i5.Future evaluateJavaScript(String? javaScriptString) => (super .noSuchMethod(Invocation.method(#evaluateJavaScript, [javaScriptString]), - returnValue: Future.value()) as _i6.Future); + returnValue: Future.value()) as _i5.Future); + @override + _i4.WKWebView copy() => (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKWebView_6()) as _i4.WKWebView); @override - _i6.Future setBackgroundColor(_i7.Color? color) => + _i5.Future setBackgroundColor(_i6.Color? color) => (super.noSuchMethod(Invocation.method(#setBackgroundColor, [color]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setOpaque(bool? opaque) => + _i5.Future setOpaque(bool? opaque) => (super.noSuchMethod(Invocation.method(#setOpaque, [opaque]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKWebViewConfiguration]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKWebViewConfiguration extends _i1.Mock implements _i4.WKWebViewConfiguration { MockWKWebViewConfiguration() { @@ -351,51 +355,54 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.WKUserContentController get userContentController => (super.noSuchMethod(Invocation.getter(#userContentController), - returnValue: _FakeWKUserContentController_4()) + returnValue: _FakeWKUserContentController_7()) as _i4.WKUserContentController); @override _i4.WKPreferences get preferences => (super.noSuchMethod(Invocation.getter(#preferences), - returnValue: _FakeWKPreferences_5()) as _i4.WKPreferences); + returnValue: _FakeWKPreferences_3()) as _i4.WKPreferences); @override _i4.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod(Invocation.getter(#websiteDataStore), - returnValue: _FakeWKWebsiteDataStore_6()) as _i4.WKWebsiteDataStore); + returnValue: _FakeWKWebsiteDataStore_8()) as _i4.WKWebsiteDataStore); @override - _i6.Future setAllowsInlineMediaPlayback(bool? allow) => (super + _i5.Future setAllowsInlineMediaPlayback(bool? allow) => (super .noSuchMethod(Invocation.method(#setAllowsInlineMediaPlayback, [allow]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future setMediaTypesRequiringUserActionForPlayback( + _i5.Future setMediaTypesRequiringUserActionForPlayback( Set<_i4.WKAudiovisualMediaType>? types) => (super.noSuchMethod( Invocation.method( #setMediaTypesRequiringUserActionForPlayback, [types]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i4.WKWebViewConfiguration copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKWebViewConfiguration_5()) + as _i4.WKWebViewConfiguration); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKWebsiteDataStore]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKWebsiteDataStore extends _i1.Mock implements _i4.WKWebsiteDataStore { MockWKWebsiteDataStore() { @@ -405,62 +412,65 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i4.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod(Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHttpCookieStore_7()) as _i4.WKHttpCookieStore); + returnValue: _FakeWKHttpCookieStore_9()) as _i4.WKHttpCookieStore); @override - _i6.Future removeDataOfTypes( + _i5.Future removeDataOfTypes( Set<_i4.WKWebsiteDataType>? dataTypes, DateTime? since) => (super.noSuchMethod( Invocation.method(#removeDataOfTypes, [dataTypes, since]), - returnValue: Future.value(false)) as _i6.Future); + returnValue: Future.value(false)) as _i5.Future); + @override + _i4.WKWebsiteDataStore copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKWebsiteDataStore_8()) as _i4.WKWebsiteDataStore); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKUIDelegate]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKUIDelegate extends _i1.Mock implements _i4.WKUIDelegate { MockWKUIDelegate() { _i1.throwOnMissingStub(this); } @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i4.WKUIDelegate copy() => (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKUIDelegate_10()) as _i4.WKUIDelegate); + @override + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [WKUserContentController]. /// /// See the documentation for Mockito's code generation for more information. +// ignore: must_be_immutable class MockWKUserContentController extends _i1.Mock implements _i4.WKUserContentController { MockWKUserContentController() { @@ -468,72 +478,74 @@ class MockWKUserContentController extends _i1.Mock } @override - _i6.Future addScriptMessageHandler( + _i5.Future addScriptMessageHandler( _i4.WKScriptMessageHandler? handler, String? name) => (super.noSuchMethod( Invocation.method(#addScriptMessageHandler, [handler, name]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeScriptMessageHandler(String? name) => (super + _i5.Future removeScriptMessageHandler(String? name) => (super .noSuchMethod(Invocation.method(#removeScriptMessageHandler, [name]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( + _i5.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( Invocation.method(#removeAllScriptMessageHandlers, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future addUserScript(_i4.WKUserScript? userScript) => + _i5.Future addUserScript(_i4.WKUserScript? userScript) => (super.noSuchMethod(Invocation.method(#addUserScript, [userScript]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeAllUserScripts() => + _i5.Future removeAllUserScripts() => (super.noSuchMethod(Invocation.method(#removeAllUserScripts, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future addObserver(_i8.NSObject? observer, - {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) => + _i4.WKUserContentController copy() => + (super.noSuchMethod(Invocation.method(#copy, []), + returnValue: _FakeWKUserContentController_7()) + as _i4.WKUserContentController); + @override + _i5.Future addObserver(_i7.NSObject? observer, + {String? keyPath, Set<_i7.NSKeyValueObservingOptions>? options}) => (super.noSuchMethod( Invocation.method( #addObserver, [observer], {#keyPath: keyPath, #options: options}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); + returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i6.Future removeObserver(_i8.NSObject? observer, {String? keyPath}) => + _i5.Future removeObserver(_i7.NSObject? observer, {String? keyPath}) => (super.noSuchMethod( Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i6.Future); - @override - _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeCopyable_1()) as _i3.Copyable); + returnValueForMissingStub: Future.value()) as _i5.Future); } /// A class which mocks [JavascriptChannelRegistry]. /// /// See the documentation for Mockito's code generation for more information. class MockJavascriptChannelRegistry extends _i1.Mock - implements _i9.JavascriptChannelRegistry { + implements _i8.JavascriptChannelRegistry { MockJavascriptChannelRegistry() { _i1.throwOnMissingStub(this); } @override - Map get channels => + Map get channels => (super.noSuchMethod(Invocation.getter(#channels), - returnValue: {}) - as Map); + returnValue: {}) + as Map); @override void onJavascriptChannelMessage(String? channel, String? message) => super.noSuchMethod( Invocation.method(#onJavascriptChannelMessage, [channel, message]), returnValueForMissingStub: null); @override - void updateJavascriptChannelsFromSet(Set<_i10.JavascriptChannel>? channels) => + void updateJavascriptChannelsFromSet(Set<_i9.JavascriptChannel>? channels) => super.noSuchMethod( Invocation.method(#updateJavascriptChannelsFromSet, [channels]), returnValueForMissingStub: null); @@ -543,17 +555,17 @@ class MockJavascriptChannelRegistry extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockWebViewPlatformCallbacksHandler extends _i1.Mock - implements _i9.WebViewPlatformCallbacksHandler { + implements _i8.WebViewPlatformCallbacksHandler { MockWebViewPlatformCallbacksHandler() { _i1.throwOnMissingStub(this); } @override - _i6.FutureOr onNavigationRequest({String? url, bool? isForMainFrame}) => + _i5.FutureOr onNavigationRequest({String? url, bool? isForMainFrame}) => (super.noSuchMethod( Invocation.method(#onNavigationRequest, [], {#url: url, #isForMainFrame: isForMainFrame}), - returnValue: Future.value(false)) as _i6.FutureOr); + returnValue: Future.value(false)) as _i5.FutureOr); @override void onPageStarted(String? url) => super.noSuchMethod(Invocation.method(#onPageStarted, [url]), @@ -567,7 +579,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock super.noSuchMethod(Invocation.method(#onProgress, [progress]), returnValueForMissingStub: null); @override - void onWebResourceError(_i11.WebResourceError? error) => + void onWebResourceError(_i10.WebResourceError? error) => super.noSuchMethod(Invocation.method(#onWebResourceError, [error]), returnValueForMissingStub: null); } @@ -576,7 +588,7 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockWebViewWidgetProxy extends _i1.Mock - implements _i12.WebViewWidgetProxy { + implements _i11.WebViewWidgetProxy { MockWebViewWidgetProxy() { _i1.throwOnMissingStub(this); } @@ -584,12 +596,12 @@ class MockWebViewWidgetProxy extends _i1.Mock @override _i4.WKWebView createWebView(_i4.WKWebViewConfiguration? configuration, {void Function( - String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)? + String, _i7.NSObject, Map<_i7.NSKeyValueChangeKey, Object?>)? observeValue}) => (super.noSuchMethod( Invocation.method( #createWebView, [configuration], {#observeValue: observeValue}), - returnValue: _FakeWKWebView_8()) as _i4.WKWebView); + returnValue: _FakeWKWebView_6()) as _i4.WKWebView); @override _i4.WKScriptMessageHandler createScriptMessageHandler( {void Function(_i4.WKUserContentController, _i4.WKScriptMessage)? @@ -597,7 +609,7 @@ class MockWebViewWidgetProxy extends _i1.Mock (super.noSuchMethod( Invocation.method(#createScriptMessageHandler, [], {#didReceiveScriptMessage: didReceiveScriptMessage}), - returnValue: _FakeWKScriptMessageHandler_9()) + returnValue: _FakeWKScriptMessageHandler_4()) as _i4.WKScriptMessageHandler); @override _i4.WKUIDelegate createUIDelgate( @@ -612,11 +624,11 @@ class MockWebViewWidgetProxy extends _i1.Mock _i4.WKNavigationDelegate createNavigationDelegate( {void Function(_i4.WKWebView, String?)? didFinishNavigation, void Function(_i4.WKWebView, String?)? didStartProvisionalNavigation, - _i6.Future<_i4.WKNavigationActionPolicy> Function( + _i5.Future<_i4.WKNavigationActionPolicy> Function( _i4.WKWebView, _i4.WKNavigationAction)? decidePolicyForNavigationAction, - void Function(_i4.WKWebView, _i8.NSError)? didFailNavigation, - void Function(_i4.WKWebView, _i8.NSError)? + void Function(_i4.WKWebView, _i7.NSError)? didFailNavigation, + void Function(_i4.WKWebView, _i7.NSError)? didFailProvisionalNavigation, void Function(_i4.WKWebView)? webViewWebContentProcessDidTerminate}) => @@ -631,6 +643,6 @@ class MockWebViewWidgetProxy extends _i1.Mock #webViewWebContentProcessDidTerminate: webViewWebContentProcessDidTerminate }), - returnValue: _FakeWKNavigationDelegate_11()) + returnValue: _FakeWKNavigationDelegate_2()) as _i4.WKNavigationDelegate); } From 8083132f178ceb2d682c248c4f9ef8f6c6cf0e86 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:11:34 -0700 Subject: [PATCH 04/31] ensure setup --- .../lib/src/web_kit/web_kit.dart | 9 +++++++++ .../lib/src/web_kit/web_kit_api_impls.dart | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) 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 36dc8c6ddac0..ffc6eb8c23bf 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 @@ -414,6 +414,8 @@ class WKScriptMessageHandler extends NSObject { instanceManager: instanceManager, ), super.detached() { + // Ensures FlutterApis for the WebKit library are set up. + WebKitFlutterApis.instance.ensureSetUp(); _scriptMessageHandlerApi.createForInstances(this); } @@ -588,6 +590,8 @@ class WKWebViewConfiguration extends NSObject { instanceManager: instanceManager, ), super.detached() { + // Ensures FlutterApis for the WebKit library are set up. + WebKitFlutterApis.instance.ensureSetUp(); _webViewConfigurationApi.createForInstances(this); } @@ -705,6 +709,8 @@ class WKUIDelegate extends NSObject { instanceManager: instanceManager, ), super.detached() { + // Ensures FlutterApis for the WebKit library are set up. + WebKitFlutterApis.instance.ensureSetUp(); _uiDelegateApi.createForInstances(this); } @@ -768,6 +774,7 @@ class WKNavigationDelegate extends NSObject { instanceManager: instanceManager, ), super.detached() { + // Ensures FlutterApis for the WebKit library are set up. WebKitFlutterApis.instance.ensureSetUp(); _navigationDelegateApi.createForInstances(this); } @@ -859,6 +866,8 @@ class WKWebView extends UIView { instanceManager: instanceManager, ), super.detached() { + // Ensures FlutterApis for the WebKit library are set up. + WebKitFlutterApis.instance.ensureSetUp(); _webViewApi.createForInstances(this, configuration); } 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 f59372b7debe..7a4fc44c9e91 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 @@ -239,7 +239,8 @@ class WebKitFlutterApis { instanceManager: instanceManager, ), scriptMessageHandler = WKScriptMessageHandlerFlutterApiImpl( - instanceManager: instanceManager), + instanceManager: instanceManager, + ), uiDelegate = WKUIDelegateFlutterApiImpl( instanceManager: instanceManager, ); @@ -299,7 +300,7 @@ class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { WKWebsiteDataStoreHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -352,7 +353,7 @@ class WKScriptMessageHandlerHostApiImpl extends WKScriptMessageHandlerHostApi { WKScriptMessageHandlerHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -407,7 +408,7 @@ class WKPreferencesHostApiImpl extends WKPreferencesHostApi { WKPreferencesHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -449,7 +450,7 @@ class WKHttpCookieStoreHostApiImpl extends WKHttpCookieStoreHostApi { WKHttpCookieStoreHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -492,7 +493,7 @@ class WKUserContentControllerHostApiImpl WKUserContentControllerHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -574,7 +575,7 @@ class WKWebViewConfigurationHostApiImpl extends WKWebViewConfigurationHostApi { WKWebViewConfigurationHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -632,7 +633,7 @@ class WKUIDelegateHostApiImpl extends WKUIDelegateHostApi { WKUIDelegateHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. @@ -829,7 +830,7 @@ class WKWebViewHostApiImpl extends WKWebViewHostApi { WKWebViewHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, - }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); /// Sends binary data across the Flutter platform barrier. From abec0061c5db3da42ef9e5e2b4bea89482a84636 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:12:03 -0700 Subject: [PATCH 05/31] current url --- .../lib/src/web_kit_webview_widget.dart | 5 +++++ 1 file changed, 5 insertions(+) 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 05a77f56f851..a0c405e5b9e9 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 @@ -270,6 +270,11 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { return webView.loadFlutterAsset(key); } + @override + Future currentUrl() { + return webView.getUrl(); + } + @override Future loadUrl(String url, Map? headers) async { final NSUrlRequest request = NSUrlRequest( From e5c820beb8c859f0c884c5e9b8f0376739943dcd Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:13:49 -0700 Subject: [PATCH 06/31] only set if nonnull --- .../ios/Classes/FWFDataConverters.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 759bfedc1621..116d950e4aea 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -17,9 +17,15 @@ return nil; } - [request setHTTPMethod:data.httpMethod]; - [request setHTTPBody:data.httpBody.data]; - [request setAllHTTPHeaderFields:data.allHttpHeaderFields]; + if (data.httpMethod) { + [request setHTTPMethod:data.httpMethod]; + } + if (data.httpBody) { + [request setHTTPBody:data.httpBody.data]; + } + if (data.allHttpHeaderFields) { + [request setAllHTTPHeaderFields:data.allHttpHeaderFields]; + } return request; } From ed678fdc1f04c45bc9e880aed5058bb1ac2b29cb Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:39:14 -0700 Subject: [PATCH 07/31] webview may have gotten it done --- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 2 +- .../Classes/FWFNavigationDelegateHostApi.m | 2 +- .../ios/Classes/FWFObjectHostApi.h | 5 +++ .../ios/Classes/FWFPreferencesHostApi.m | 2 +- .../Classes/FWFScriptMessageHandlerHostApi.m | 1 + .../ios/Classes/FWFScrollViewHostApi.m | 2 +- .../ios/Classes/FWFUIViewHostApi.m | 2 +- .../Classes/FWFUserContentControllerHostApi.m | 2 +- .../Classes/FWFWebViewConfigurationHostApi.m | 2 +- .../ios/Classes/FWFWebViewHostApi.h | 12 +++++- .../ios/Classes/FWFWebViewHostApi.m | 39 ++++++++++++++++--- .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 2 +- 12 files changed, 58 insertions(+), 15 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 3ad0a169b81f..3f0044e56898 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -7,7 +7,7 @@ #import "FWFWebsiteDataStoreHostApi.h" @interface FWFHTTPCookieStoreHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFHTTPCookieStoreHostApiImpl 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 6946783088d5..7bf1f47e7c07 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -183,8 +183,8 @@ - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { @end @interface FWFNavigationDelegateHostApiImpl () +// Reference must be weak to prevent a circular reference with the objects it stores. @property(weak) id binaryMessenger; -// This reference must be weak to prevent a circular reference with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h index 1f7b2943974e..5453a2b256d1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h @@ -17,6 +17,11 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFObjectFlutterApiImpl : FWFNSObjectFlutterApi - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; +- (void)observeValueForObject:(NSObject *)instance + keyPath:(NSString *)keyPath + object:(NSObject *)object + change:(NSDictionary *)change + completion:(void (^)(NSError *_Nullable))completion; @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 index dbb04fccccd2..de7ab016a1f9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -6,7 +6,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFPreferencesHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFPreferencesHostApiImpl 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 69ace0202824..86306a1849c3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -62,6 +62,7 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont @end @interface FWFScriptMessageHandlerHostApiImpl () +// This reference must be weak to prevent a circular reference with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 fb77b717aa64..c686e36bd186 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -6,7 +6,7 @@ #import "FWFWebViewHostApi.h" @interface FWFScrollViewHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFScrollViewHostApiImpl 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 465738b570cd..8200ba005956 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -5,7 +5,7 @@ #import "FWFUIViewHostApi.h" @interface FWFUIViewHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFUIViewHostApiImpl 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 d15341a7883d..1a45163f6ec9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -7,7 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFUserContentControllerHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFUserContentControllerHostApiImpl 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 05ca38e2a477..6d1a11d3e890 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -7,7 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFWebViewConfigurationHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFWebViewConfigurationHostApiImpl diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h index 968a9a85b2e7..99e9961537c4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h @@ -7,6 +7,7 @@ #import "FWFGeneratedWebKitApis.h" #import "FWFInstanceManager.h" +#import "FWFObjectHostApi.h" NS_ASSUME_NONNULL_BEGIN @@ -23,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN * Implementation of WKWebView that can be used as a FlutterPlatformView. */ @interface FWFWebView : WKWebView +@property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; +- (instancetype)initWithFrame:(CGRect)frame + configuration:(nonnull WKWebViewConfiguration *)configuration + binaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; @end /** @@ -31,8 +37,10 @@ NS_ASSUME_NONNULL_BEGIN * Handles creating WKWebViews that intercommunicate with a paired Dart object. */ @interface FWFWebViewHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager bundle:(NSBundle *)bundle assetManager:(FWFAssetManager *)assetManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 66149dd9ed37..1324ddeb1c74 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -12,6 +12,18 @@ - (NSString *)lookupKeyForAsset:(NSString *)asset { @end @implementation FWFWebView +- (instancetype)initWithFrame:(CGRect)frame + configuration:(nonnull WKWebViewConfiguration *)configuration + binaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self initWithFrame:frame configuration:configuration]; + if (self) { + _objectApi = [[FWFObjectFlutterApiImpl alloc] initWithBinaryMessenger:binaryMessenger + instanceManager:instanceManager]; + } + return self; +} + - (void)setFrame:(CGRect)frame { [super setFrame:frame]; // Prevents the contentInsets from being adjusted by iOS and gives control to Flutter. @@ -28,29 +40,44 @@ - (void)setFrame:(CGRect)frame { } } +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + [self.objectApi observeValueForObject:self + keyPath:keyPath + object:object + change:change + completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; +} + - (nonnull UIView *)view { return self; } @end @interface FWFWebViewHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(weak) id binaryMessenger; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @property NSBundle *bundle; @property FWFAssetManager *assetManager; @end @implementation FWFWebViewHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { - return [self initWithInstanceManager:instanceManager +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + return [self initWithBinaryMessenger:binaryMessenger + instanceManager:instanceManager bundle:[NSBundle mainBundle] assetManager:[[FWFAssetManager alloc] init]]; } -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager bundle:(NSBundle *)bundle assetManager:(FWFAssetManager *)assetManager { self = [self init]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; _bundle = bundle; _assetManager = assetManager; @@ -77,7 +104,9 @@ - (void)createWithIdentifier:(nonnull NSNumber *)identifier WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:configurationIdentifier.longValue]; FWFWebView *webView = [[FWFWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) - configuration:configuration]; + configuration:configuration + binaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:webView withIdentifier:identifier.longValue]; } 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 4587917ba640..e5fbf6dbd9c7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -7,7 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFWebsiteDataStoreHostApiImpl () -@property(nonatomic) FWFInstanceManager *instanceManager; +@property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFWebsiteDataStoreHostApiImpl From 2edf7d7b84e3ef02313241548127abc5acb0242f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:21:53 -0700 Subject: [PATCH 08/31] some more objc polish --- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 2 ++ .../Classes/FWFNavigationDelegateHostApi.m | 6 ++-- .../ios/Classes/FWFObjectHostApi.m | 6 ++-- .../ios/Classes/FWFPreferencesHostApi.m | 2 ++ .../Classes/FWFScriptMessageHandlerHostApi.h | 3 +- .../Classes/FWFScriptMessageHandlerHostApi.m | 13 +++++--- .../ios/Classes/FWFScrollViewHostApi.m | 2 ++ .../ios/Classes/FWFUIDelegateHostApi.h | 3 +- .../ios/Classes/FWFUIDelegateHostApi.m | 12 +++++-- .../ios/Classes/FWFUIViewHostApi.m | 2 ++ .../Classes/FWFUserContentControllerHostApi.m | 2 ++ .../Classes/FWFWebViewConfigurationHostApi.h | 10 +++++- .../Classes/FWFWebViewConfigurationHostApi.m | 31 +++++++++++++++++-- .../ios/Classes/FWFWebViewHostApi.m | 2 ++ .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 2 ++ 15 files changed, 82 insertions(+), 16 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 3f0044e56898..f51d52679232 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -7,6 +7,8 @@ #import "FWFWebsiteDataStoreHostApi.h" @interface FWFHTTPCookieStoreHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 7bf1f47e7c07..18a77aab0295 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -7,7 +7,8 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFNavigationDelegateFlutterApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -183,7 +184,8 @@ - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { @end @interface FWFNavigationDelegateHostApiImpl () -// Reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 f88b91750493..8d4b45947ea5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -6,7 +6,8 @@ #import "FWFDataConverters.h" @interface FWFObjectFlutterApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -74,7 +75,8 @@ - (void)observeValueForKeyPath:(NSString *)keyPath @end @interface FWFObjectHostApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index de7ab016a1f9..514a221746f5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -6,6 +6,8 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFPreferencesHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h index 36f12feac3fe..d608b0ef0149 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h @@ -37,7 +37,8 @@ NS_ASSUME_NONNULL_BEGIN * Handles creating WKScriptMessageHandler that intercommunicate with a paired Dart object. */ @interface FWFScriptMessageHandlerHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(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 index 86306a1849c3..e90b12bbfd7e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -6,7 +6,8 @@ #import "FWFDataConverters.h" @interface FWFScriptMessageHandlerFlutterApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -62,14 +63,18 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont @end @interface FWFScriptMessageHandlerHostApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. +@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFScriptMessageHandlerHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { self = [self init]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -82,7 +87,7 @@ - (FWFScriptMessageHandler *)scriptMessageHandlerForIdentifier:(NSNumber *)ident - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] init]; + FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:scriptMessageHandler withIdentifier:identifier.longValue]; } 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 c686e36bd186..09454666e900 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -6,6 +6,8 @@ #import "FWFWebViewHostApi.h" @interface FWFScrollViewHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 65c148e6b0b1..195b4899a3dc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h @@ -36,7 +36,8 @@ NS_ASSUME_NONNULL_BEGIN * Handles creating WKUIDelegate that intercommunicate with a paired Dart object. */ @interface FWFUIDelegateHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(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 index 4ec8b583b1f8..fa46069e96ee 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -7,7 +7,8 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFUIDelegateFlutterApiImpl () -// This reference must be weak to prevent a circular reference with the objects it stores. +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -71,13 +72,18 @@ - (WKWebView *)webView:(WKWebView *)webView @end @interface FWFUIDelegateHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. +@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFUIDelegateHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { self = [self init]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -89,7 +95,7 @@ - (FWFUIDelegate *)delegateForIdentifier:(NSNumber *)identifier { - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] init]; + FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier.longValue]; } @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 8200ba005956..7a7e4fa93d84 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -5,6 +5,8 @@ #import "FWFUIViewHostApi.h" @interface FWFUIViewHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 1a45163f6ec9..6fb734e63225 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -7,6 +7,8 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFUserContentControllerHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 4c01d9354107..4437b790476f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -7,16 +7,24 @@ #import "FWFGeneratedWebKitApis.h" #import "FWFInstanceManager.h" +#import "FWFObjectHostApi.h" NS_ASSUME_NONNULL_BEGIN +@interface FWFWebViewConfiguration : WKWebViewConfiguration +@property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +@end + /** * Host api implementation for WKWebViewConfiguration. * * Handles creating WKWebViewConfiguration that intercommunicate with a paired Dart object. */ @interface FWFWebViewConfigurationHostApiImpl : NSObject -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(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 index 6d1a11d3e890..608040f18f39 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -6,14 +6,41 @@ #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" +@implementation FWFWebViewConfiguration +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self init]; + if (self) { + _objectApi = [[FWFObjectFlutterApiImpl alloc] initWithBinaryMessenger:binaryMessenger + instanceManager:instanceManager]; + } + return self; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + [self.objectApi observeValueForObject:self + keyPath:keyPath + object:object + change:change + completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; +} +@end + @interface FWFWebViewConfigurationHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. +@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @implementation FWFWebViewConfigurationHostApiImpl -- (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { self = [self init]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -26,7 +53,7 @@ - (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSNumber *)identi - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - WKWebViewConfiguration *webViewConfiguration = [[WKWebViewConfiguration alloc] init]; + FWFWebViewConfiguration *webViewConfiguration = [[FWFWebViewConfiguration alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:webViewConfiguration withIdentifier:identifier.longValue]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 1324ddeb1c74..a8406ed128a3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -56,6 +56,8 @@ - (nonnull UIView *)view { @end @interface FWFWebViewHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @property NSBundle *bundle; 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 e5fbf6dbd9c7..9d5beb202f60 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -7,6 +7,8 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFWebsiteDataStoreHostApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end From 4ffc2de2204cabb418b1ea931785b0686b862cec Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:23:24 -0700 Subject: [PATCH 09/31] formatting --- .../ios/Classes/FWFScriptMessageHandlerHostApi.m | 4 +++- .../ios/Classes/FWFUIDelegateHostApi.m | 3 ++- .../ios/Classes/FWFWebViewConfigurationHostApi.h | 4 ++-- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 9 +++++++-- .../ios/Classes/FWFWebViewHostApi.m | 5 ++++- 5 files changed, 18 insertions(+), 7 deletions(-) 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 e90b12bbfd7e..5203f0146227 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -87,7 +87,9 @@ - (FWFScriptMessageHandler *)scriptMessageHandlerForIdentifier:(NSNumber *)ident - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; + FWFScriptMessageHandler *scriptMessageHandler = + [[FWFScriptMessageHandler alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:scriptMessageHandler withIdentifier:identifier.longValue]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index fa46069e96ee..fa96ff2b8749 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -95,7 +95,8 @@ - (FWFUIDelegate *)delegateForIdentifier:(NSNumber *)identifier { - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; + FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier.longValue]; } @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 index 4437b790476f..d062af1c9b18 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFWebViewConfiguration : WKWebViewConfiguration @property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; - (instancetype)initWithBinaryMessenger:(id)binaryMessenger - instanceManager:(FWFInstanceManager *)instanceManager; + instanceManager:(FWFInstanceManager *)instanceManager; @end /** @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFWebViewConfigurationHostApiImpl : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger - instanceManager:(FWFInstanceManager *)instanceManager; + instanceManager:(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 index 608040f18f39..708213366ee9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -17,7 +17,10 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen return self; } -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context { [self.objectApi observeValueForObject:self keyPath:keyPath object:object @@ -53,7 +56,9 @@ - (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSNumber *)identi - (void)createWithIdentifier:(nonnull NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error { - FWFWebViewConfiguration *webViewConfiguration = [[FWFWebViewConfiguration alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; + FWFWebViewConfiguration *webViewConfiguration = + [[FWFWebViewConfiguration alloc] initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; [self.instanceManager addDartCreatedInstance:webViewConfiguration withIdentifier:identifier.longValue]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index a8406ed128a3..0edf5e298c7c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -40,7 +40,10 @@ - (void)setFrame:(CGRect)frame { } } -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context { [self.objectApi observeValueForObject:self keyPath:keyPath object:object From 8b7f28a274a53fee84b3cd35fd8efe7ceb04aba4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:30:02 -0700 Subject: [PATCH 10/31] passing tests --- .../FWFScriptMessageHandlerHostApiTests.m | 5 +- .../RunnerTests/FWFUIDelegateHostApiTests.m | 5 +- .../FWFWebViewConfigurationHostApiTests.m | 20 ++-- .../ios/RunnerTests/FWFWebViewHostApiTests.m | 99 +++++++++++-------- 4 files changed, 77 insertions(+), 52 deletions(-) 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 5a51e7b980f8..84d31d1c543e 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 @@ -45,8 +45,9 @@ - (id)mockFlutterApiWithManager:(FWFInstanceManager *)instanceManager { - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFScriptMessageHandlerHostApiImpl *hostAPI = - [[FWFScriptMessageHandlerHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFScriptMessageHandlerHostApiImpl *hostAPI = [[FWFScriptMessageHandlerHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI createWithIdentifier:@0 error:&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 index 17cb4367b3aa..45ef7a517e74 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 @@ -45,8 +45,9 @@ - (id)mockFlutterApiWithManager:(FWFInstanceManager *)instanceManager { - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFUIDelegateHostApiImpl *hostAPI = - [[FWFUIDelegateHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFUIDelegateHostApiImpl *hostAPI = [[FWFUIDelegateHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI createWithIdentifier:@0 error:&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 e09e16b62e45..2ec74d0522dd 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 @@ -14,8 +14,9 @@ @interface FWFWebViewConfigurationHostApiTests : XCTestCase @implementation FWFWebViewConfigurationHostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFWebViewConfigurationHostApiImpl *hostAPI = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewConfigurationHostApiImpl *hostAPI = [[FWFWebViewConfigurationHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI createWithIdentifier:@0 error:&error]; @@ -27,8 +28,9 @@ - (void)testCreateWithIdentifier { - (void)testCreateFromWebViewWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFWebViewConfigurationHostApiImpl *hostAPI = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewConfigurationHostApiImpl *hostAPI = [[FWFWebViewConfigurationHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; WKWebView *mockWebView = OCMClassMock([WKWebView class]); OCMStub([mockWebView configuration]).andReturn(OCMClassMock([WKWebViewConfiguration class])); @@ -48,8 +50,9 @@ - (void)testSetAllowsInlineMediaPlayback { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebViewConfiguration withIdentifier:0]; - FWFWebViewConfigurationHostApiImpl *hostAPI = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewConfigurationHostApiImpl *hostAPI = [[FWFWebViewConfigurationHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 @@ -65,8 +68,9 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebViewConfiguration withIdentifier:0]; - FWFWebViewConfigurationHostApiImpl *hostAPI = - [[FWFWebViewConfigurationHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewConfigurationHostApiImpl *hostAPI = [[FWFWebViewConfigurationHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI 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 0c71e3391dbb..23a7b6805377 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 @@ -14,8 +14,9 @@ @interface FWFWebViewHostApiTests : XCTestCase @implementation FWFWebViewHostApiTests - (void)testCreateWithIdentifier { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; @@ -32,8 +33,9 @@ - (void)testLoadRequest { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; FWFNSUrlRequestData *requestData = [FWFNSUrlRequestData makeWithUrl:@"https://www.flutter.dev" @@ -57,8 +59,9 @@ - (void)testLoadRequestWithInvalidUrl { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; FWFNSUrlRequestData *requestData = [FWFNSUrlRequestData makeWithUrl:@"%invalidUrl%" @@ -78,8 +81,9 @@ - (void)testSetCustomUserAgent { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI setUserAgentForWebViewWithIdentifier:@0 userAgent:@"userA" error:&error]; @@ -94,8 +98,9 @@ - (void)testURL { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; XCTAssertEqualObjects([hostAPI URLForWebViewWithIdentifier:@0 error:&error], @@ -110,8 +115,9 @@ - (void)testCanGoBack { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; XCTAssertEqualObjects([hostAPI canGoBackForWebViewWithIdentifier:@0 error:&error], @YES); @@ -124,8 +130,9 @@ - (void)testSetUIDelegate { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; id mockDelegate = OCMProtocolMock(@protocol(WKUIDelegate)); [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; @@ -142,8 +149,9 @@ - (void)testSetNavigationDelegate { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; id mockDelegate = OCMProtocolMock(@protocol(WKNavigationDelegate)); [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; @@ -161,8 +169,9 @@ - (void)testEstimatedProgress { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; XCTAssertEqualObjects([hostAPI estimatedProgressForWebViewWithIdentifier:@0 error:&error], @34.0); @@ -175,8 +184,9 @@ - (void)testloadHTMLString { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI loadHTMLForWebViewWithIdentifier:@0 @@ -193,8 +203,9 @@ - (void)testLoadFileURL { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI loadFileForWebViewWithIdentifier:@0 @@ -222,10 +233,11 @@ - (void)testLoadFlutterAsset { OCMStub([mockBundle URLForResource:@"myFolder/assets/index" withExtension:@"html"]) .andReturn([NSURL URLWithString:@"webview_flutter/myFolder/assets/index.html"]); - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager - bundle:mockBundle - assetManager:mockAssetManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager + bundle:mockBundle + assetManager:mockAssetManager]; FlutterError *error; [hostAPI loadAssetForWebViewWithIdentifier:@0 assetKey:@"assets/index.html" error:&error]; @@ -243,8 +255,9 @@ - (void)testCanGoForward { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; XCTAssertEqualObjects([hostAPI canGoForwardForWebViewWithIdentifier:@0 error:&error], @NO); @@ -257,8 +270,9 @@ - (void)testGoBack { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI goBackForWebViewWithIdentifier:@0 error:&error]; @@ -272,8 +286,9 @@ - (void)testGoForward { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI goForwardForWebViewWithIdentifier:@0 error:&error]; @@ -287,8 +302,9 @@ - (void)testReload { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI reloadWebViewWithIdentifier:@0 error:&error]; @@ -303,8 +319,9 @@ - (void)testTitle { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; XCTAssertEqualObjects([hostAPI titleForWebViewWithIdentifier:@0 error:&error], @"myTitle"); @@ -317,8 +334,9 @@ - (void)testSetAllowsBackForwardNavigationGestures { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; FlutterError *error; [hostAPI setAllowsBackForwardForWebViewWithIdentifier:@0 isAllowed:@YES error:&error]; @@ -336,8 +354,9 @@ - (void)testEvaluateJavaScript { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; NSString __block *returnValue; FlutterError __block *returnError; From 613d5ac945ba50a59c626b762afadcdccfcd9896 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:37:01 -0700 Subject: [PATCH 11/31] prevent progress bug --- .../lib/src/web_kit_webview_widget.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 a0c405e5b9e9..f99cb92a73f4 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 @@ -93,6 +93,7 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { bool _zoomEnabled = true; bool _hasNavigationDelegate = false; + bool _hasProgressTracking = false; final Map _scriptMessageHandlers = {}; @@ -457,9 +458,14 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { await _resetUserScripts(removedJavaScriptChannels: javascriptChannelNames); } - Future _setHasProgressTracking(bool hasProgressTracking) { + Future _setHasProgressTracking(bool hasProgressTracking) async { + // Calls to removeObserver before addObserver causes a crash. + if (_hasProgressTracking == hasProgressTracking) { + return; + } + _hasProgressTracking = hasProgressTracking; if (hasProgressTracking) { - return webView.addObserver( + await webView.addObserver( webView, keyPath: 'estimatedProgress', options: { @@ -467,7 +473,7 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { }, ); } else { - return webView.removeObserver(webView, keyPath: 'estimatedProgress'); + await webView.removeObserver(webView, keyPath: 'estimatedProgress'); } } From 6c059cf31c7eab932808d440f8b60e19a16c6893 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:41:33 -0700 Subject: [PATCH 12/31] pass error data back --- .../webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 0edf5e298c7c..b04b66961789 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -185,7 +185,7 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie } else { flutterError = [FlutterError errorWithCode:@"FWFEvaluateJavaScriptError" message:@"Failed evaluating JavaScript." - details:error]; + details:FWFNSErrorDataFromNSError(error)]; } completion(returnValue, flutterError); From 1bfa38e7b7e30e4ce0185d9853591ee7a4f93665 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:15:54 -0700 Subject: [PATCH 13/31] return errors instead --- .../ios/Classes/FWFWebViewHostApi.m | 7 ++-- .../lib/src/web_kit_webview_widget.dart | 36 +++++++++++-------- .../test/src/web_kit_webview_widget_test.dart | 17 +++++---- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index b04b66961789..ffc746b0779d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -170,7 +170,6 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie evaluateJavaScript:javaScriptString completionHandler:^(id _Nullable result, NSError *_Nullable error) { id returnValue = nil; - FlutterError *flutterError = nil; if (!error) { if (!result || [result isKindOfClass:[NSString class]] || [result isKindOfClass:[NSNumber class]]) { @@ -183,12 +182,10 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie returnValue = [result description]; } } else { - flutterError = [FlutterError errorWithCode:@"FWFEvaluateJavaScriptError" - message:@"Failed evaluating JavaScript." - details:FWFNSErrorDataFromNSError(error)]; + returnValue = FWFNSErrorDataFromNSError(error); } - completion(returnValue, flutterError); + completion(returnValue, nil); }]; } 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 f99cb92a73f4..ef447bb7d382 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 @@ -328,20 +328,21 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { @override Future runJavascript(String javascript) async { - try { - await webView.evaluateJavaScript(javascript); - } on PlatformException catch (exception) { - // WebKit will throw an error when the type of the evaluated value is - // unsupported. This also goes for `null` and `undefined` on iOS 14+. For - // example, when running a void function. For ease of use, this specific - // error is ignored when no return value is expected. - // TODO(bparrishMines): Ensure the platform code includes the NSError in - // the FlutterError.details. - if (exception.details is! NSError || - exception.details.code != - WKErrorCode.javaScriptResultTypeIsUnsupported) { - rethrow; - } + final Object? result = await webView.evaluateJavaScript(javascript); + // WebKit will throw an error when the type of the evaluated value is + // unsupported. This also goes for `null` and `undefined` on iOS 14+. For + // example, when running a void function. For ease of use, this specific + // error is ignored when no return value is expected. + if (result is NSError && + result.code == WKErrorCode.javaScriptResultTypeIsUnsupported) { + return; + } else if (result is NSError) { + throw PlatformException( + code: 'runJavascript_failed', + message: 'Failed running JavaScript', + details: + "JavaScript string was: '$javascript'\n${result.localizedDescription}", + ); } } @@ -353,6 +354,13 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { 'Result of JavaScript execution returned a `null` value. ' 'Use `runJavascript` when expecting a null return value.', ); + } else if (result is NSError) { + throw PlatformException( + code: 'runJavascriptReturningResult_failed', + message: 'Failed running JavaScript', + details: + "JavaScript string was: '$javascript'\n${result.localizedDescription}", + ); } return result.toString(); } 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 24155d2a05e1..0e27ab83bf3a 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 @@ -6,7 +6,6 @@ import 'dart:math'; import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -724,15 +723,15 @@ void main() { (WidgetTester tester) async { await buildWidget(tester); - when(mockWebView.evaluateJavaScript('runJavaScript')) - .thenThrow(PlatformException( - code: '', - details: const NSError( - code: WKErrorCode.javaScriptResultTypeIsUnsupported, - domain: '', - localizedDescription: '', + when(mockWebView.evaluateJavaScript('runJavaScript')).thenAnswer( + (_) => Future.value( + const NSError( + code: WKErrorCode.javaScriptResultTypeIsUnsupported, + domain: '', + localizedDescription: '', + ), ), - )); + ); expect( testController.runJavascript('runJavaScript'), completes, From 6aaf2c24bb83415353b1d185d24a6d76b53eed56 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:29:39 -0700 Subject: [PATCH 14/31] fix returning non bool --- .../example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m | 1 + .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 18bc21facd21..6f9775bab220 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 @@ -70,6 +70,7 @@ - (void)testRemoveDataOfTypes { blockError = error; }]; XCTAssertEqualObjects(returnValue, @YES); + XCTAssertEqual(CFBooleanGetTypeID(), CFGetTypeID((__bridge CFTypeRef)(returnValue))); XCTAssertNil(blockError); } @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 9d5beb202f60..92c47a6afd3a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -62,7 +62,7 @@ - (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)identifier modifiedSince:[NSDate dateWithTimeIntervalSince1970: modificationTimeInSecondsSinceEpoch.doubleValue] completionHandler:^{ - completion(@(records.count > 0), nil); + completion([NSNumber numberWithBool:(records.count > 0)], nil); }]; }]; } From 1ab7ceb85a68a2344f43b6347c4b5270f39bc8a2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:39:53 -0700 Subject: [PATCH 15/31] return expected string bool and double values --- .../lib/src/web_kit_webview_widget.dart | 4 ++++ 1 file changed, 4 insertions(+) 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 ef447bb7d382..557cde87b411 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 @@ -598,6 +598,10 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { stringValues.add(_asObjectiveCString(listValue, inContainer: true)); } return '(${stringValues.join(',')})'; + } else if (value is bool) { + return value ? '1' : '0'; + } else if (value is double && value.truncate() == value) { + return value.truncate().toString(); } else if (value is Map) { final List stringValues = []; for (final MapEntry entry in value.entries) { From 3c7090a7b774c794e4e5ec8177a936e1b7c6993c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:45:13 -0700 Subject: [PATCH 16/31] use objective c string as returning result --- .../lib/src/web_kit_webview_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 557cde87b411..db2f7c2d2850 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 @@ -362,7 +362,7 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { "JavaScript string was: '$javascript'\n${result.localizedDescription}", ); } - return result.toString(); + return _asObjectiveCString(result); } @override From 4ff2fc0662ec89678e3b238a02fd72d867fd1e5d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:25:54 -0700 Subject: [PATCH 17/31] dart side of addiing dispose and create webview configuration --- .../ios/Classes/FWFGeneratedWebKitApis.h | 347 +--- .../ios/Classes/FWFGeneratedWebKitApis.m | 1824 ++++++++--------- .../lib/src/common/web_kit.pigeon.dart | 1225 +++++------ .../src/foundation/foundation_api_impls.dart | 7 +- .../lib/src/ui_kit/ui_kit_api_impls.dart | 3 - .../lib/src/web_kit/web_kit_api_impls.dart | 54 +- .../pigeons/web_kit.dart | 12 + .../test/src/common/test_web_kit.pigeon.dart | 860 +++----- 8 files changed, 1868 insertions(+), 2464 deletions(-) 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 ebd29f5cacad..9cda5d48631f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v3.1.4), do not edit directly. +// Autogenerated from Pigeon (v3.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; @@ -146,201 +146,147 @@ 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 FWFWKNavigationActionData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame; -@property(nonatomic, strong) FWFNSUrlRequestData *request; -@property(nonatomic, strong) FWFWKFrameInfoData *targetFrame; + targetFrame:(FWFWKFrameInfoData *)targetFrame; +@property(nonatomic, strong) FWFNSUrlRequestData * request; +@property(nonatomic, strong) FWFWKFrameInfoData * targetFrame; @end @interface FWFWKFrameInfoData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber *isMainFrame; +@property(nonatomic, strong) NSNumber * isMainFrame; @end @interface FWFNSErrorData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription; -@property(nonatomic, strong) NSNumber *code; -@property(nonatomic, copy) NSString *domain; -@property(nonatomic, copy) NSString *localizedDescription; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription; +@property(nonatomic, strong) NSNumber * code; +@property(nonatomic, copy) NSString * domain; +@property(nonatomic, copy) NSString * localizedDescription; @end @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name body:(id)body; -@property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) id body; ++ (instancetype)makeWithName:(NSString *)name + body:(id )body; +@property(nonatomic, copy) NSString * name; +@property(nonatomic, strong) id body; @end @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 *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier - ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch - completion:(void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier - toValue:(nullable NSNumber *)value - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier - isOpaque:(NSNumber *)opaque - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier - x:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - toX:(NSNumber *)x - y:(NSNumber *)y - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier - forTypes: - (NSArray< - FWFWKAudiovisualMediaTypeEnumData - *> *)types - error: - (FlutterError *_Nullable *_Nonnull) - error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +/// The codec used by FWFWKWebViewConfigurationFlutterApi. +NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void); + +@interface FWFWKWebViewConfigurationFlutterApi : NSObject +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; +- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +@end /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - handlerIdentifier:(NSNumber *)handlerIdentifier - ofName:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - name:(NSString *)name - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier - error: - (FlutterError *_Nullable *_Nonnull) - error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier - userScript:(FWFWKUserScriptData *)userScript - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier handlerIdentifier:(NSNumber *)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier - isEnabled:(NSNumber *)enabled - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -349,19 +295,14 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerFlutterApi. NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void); @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier - userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier - message:(FWFWKScriptMessageData *)message - completion:(void (^)(NSError *_Nullable))completion; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @@ -370,143 +311,67 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( - id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - URL:(nullable NSString *)url - completion:(void (^)(NSError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - URL:(nullable NSString *)url - completion: - (void (^)(NSError *_Nullable))completion; -- (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - navigationAction: - (FWFWKNavigationActionData *)navigationAction - completion: - (void (^)(FWFWKNavigationActionPolicyEnumData - *_Nullable, - NSError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FWFNSErrorData *)error - completion:(void (^)(NSError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - error:(FWFNSErrorData *)error - completion: - (void (^)(NSError *_Nullable))completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - completion:(void (^)(NSError *_Nullable)) - completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion; +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier - keyPath:(NSString *)keyPath - options: - (NSArray *)options - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier - keyPath:(NSString *)keyPath - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. NSObject *FWFNSObjectFlutterApiGetCodec(void); @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier - keyPath:(NSString *)keyPath - objectIdentifier:(NSNumber *)objectIdentifier - changeKeys:(NSArray *)changeKeys - changeValues:(NSArray *)changeValues - completion:(void (^)(NSError *_Nullable))completion; +- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier keyPath:(NSString *)keyPath objectIdentifier:(NSNumber *)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void(^)(NSError *_Nullable))completion; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier - delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier - delegateIdentifier: - (nullable NSNumber *)navigationDelegateIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull) - error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier - request:(FWFNSUrlRequestData *)request - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier - HTMLString:(NSString *)string - baseURL:(nullable NSString *)baseUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier - fileURL:(NSString *)url - readAccessURL:(NSString *)readAccessUrl - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier - assetKey:(NSString *)key - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier - error: - (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier - userAgent:(nullable NSString *)userAgent - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier - javaScriptString:(NSString *)javaScriptString - completion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -515,33 +380,23 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - configurationIdentifier:(NSNumber *)configurationIdentifier - navigationAction:(FWFWKNavigationActionData *)navigationAction - completion:(void (^)(NSError *_Nullable))completion; +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier configurationIdentifier:(NSNumber *)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier - dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier - cookie:(FWFNSHttpCookieData *)cookie - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, - NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); 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 592fa87ac9d1..4801175cd328 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v3.1.4), do not edit directly. +// Autogenerated from Pigeon (v3.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "FWFGeneratedWebKitApis.h" #import @@ -14,95 +14,109 @@ NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ - @"code" : (error.code ?: [NSNull null]), - @"message" : (error.message ?: [NSNull null]), - @"details" : (error.details ?: [NSNull null]), - }; + @"code": (error.code ?: [NSNull null]), + @"message": (error.message ?: [NSNull null]), + @"details": (error.details ?: [NSNull null]), + }; } return @{ - @"result" : (result ?: [NSNull null]), - @"error" : errorDict, - }; + @"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; ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSKeyValueChangeKeyEnumData () + (FWFNSKeyValueChangeKeyEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKUserScriptInjectionTimeEnumData () + (FWFWKUserScriptInjectionTimeEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKAudiovisualMediaTypeEnumData () + (FWFWKAudiovisualMediaTypeEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKWebsiteDataTypeEnumData () + (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKNavigationActionPolicyEnumData () + (FWFWKNavigationActionPolicyEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSHttpCookiePropertyKeyEnumData () + (FWFNSHttpCookiePropertyKeyEnumData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSUrlRequestData () + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKUserScriptData () + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKNavigationActionData () + (FWFWKNavigationActionData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKFrameInfoData () + (FWFWKFrameInfoData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSErrorData () + (FWFNSErrorData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFWKScriptMessageData () + (FWFWKScriptMessageData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface FWFNSHttpCookieData () + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict; ++ (nullable FWFNSHttpCookieData *)nullableFromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @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; } ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSKeyValueObservingOptionsEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -112,7 +126,7 @@ - (NSDictionary *)toMap { @implementation FWFNSKeyValueChangeKeyEnumData + (instancetype)makeWithValue:(FWFNSKeyValueChangeKeyEnum)value { - FWFNSKeyValueChangeKeyEnumData *pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; + FWFNSKeyValueChangeKeyEnumData* pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -121,6 +135,7 @@ + (FWFNSKeyValueChangeKeyEnumData *)fromMap:(NSDictionary *)dict { pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSKeyValueChangeKeyEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -130,17 +145,16 @@ - (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; } ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKUserScriptInjectionTimeEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -150,17 +164,16 @@ - (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; } ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKAudiovisualMediaTypeEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -170,7 +183,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -179,6 +192,7 @@ + (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict { pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKWebsiteDataTypeEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -188,17 +202,16 @@ - (NSDictionary *)toMap { @implementation FWFWKNavigationActionPolicyEnumData + (instancetype)makeWithValue:(FWFWKNavigationActionPolicyEnum)value { - FWFWKNavigationActionPolicyEnumData *pigeonResult = - [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData* pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKNavigationActionPolicyEnumData *)fromMap:(NSDictionary *)dict { - FWFWKNavigationActionPolicyEnumData *pigeonResult = - [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKNavigationActionPolicyEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -208,17 +221,16 @@ - (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; } ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSHttpCookiePropertyKeyEnumData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -228,10 +240,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; @@ -248,6 +260,7 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } ++ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSUrlRequestData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"url" : (self.url ?: [NSNull null]), @@ -260,9 +273,9 @@ - (NSDictionary *)toMap { @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; @@ -272,12 +285,12 @@ + (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 nullableFromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } ++ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKUserScriptData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"source" : (self.source ?: [NSNull null]), @@ -289,20 +302,21 @@ - (NSDictionary *)toMap { @implementation FWFWKNavigationActionData + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame { - FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; + targetFrame:(FWFWKFrameInfoData *)targetFrame { + FWFWKNavigationActionData* pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = request; pigeonResult.targetFrame = targetFrame; return pigeonResult; } + (FWFWKNavigationActionData *)fromMap:(NSDictionary *)dict { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; - pigeonResult.request = [FWFNSUrlRequestData fromMap:GetNullableObject(dict, @"request")]; + pigeonResult.request = [FWFNSUrlRequestData nullableFromMap:GetNullableObject(dict, @"request")]; NSAssert(pigeonResult.request != nil, @""); - pigeonResult.targetFrame = [FWFWKFrameInfoData fromMap:GetNullableObject(dict, @"targetFrame")]; + pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromMap:GetNullableObject(dict, @"targetFrame")]; NSAssert(pigeonResult.targetFrame != nil, @""); return pigeonResult; } ++ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKNavigationActionData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"request" : (self.request ? [self.request toMap] : [NSNull null]), @@ -313,7 +327,7 @@ - (NSDictionary *)toMap { @implementation FWFWKFrameInfoData + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { - FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; + FWFWKFrameInfoData* pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } @@ -323,6 +337,7 @@ + (FWFWKFrameInfoData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.isMainFrame != nil, @""); return pigeonResult; } ++ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKFrameInfoData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"isMainFrame" : (self.isMainFrame ?: [NSNull null]), @@ -332,9 +347,9 @@ - (NSDictionary *)toMap { @implementation FWFNSErrorData + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription { - FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription { + FWFNSErrorData* pigeonResult = [[FWFNSErrorData alloc] init]; pigeonResult.code = code; pigeonResult.domain = domain; pigeonResult.localizedDescription = localizedDescription; @@ -350,6 +365,7 @@ + (FWFNSErrorData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.localizedDescription != nil, @""); return pigeonResult; } ++ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSErrorData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"code" : (self.code ?: [NSNull null]), @@ -360,8 +376,9 @@ - (NSDictionary *)toMap { @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name body:(id)body { - FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; ++ (instancetype)makeWithName:(NSString *)name + body:(id )body { + FWFWKScriptMessageData* pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; return pigeonResult; @@ -373,6 +390,7 @@ + (FWFWKScriptMessageData *)fromMap:(NSDictionary *)dict { pigeonResult.body = GetNullableObject(dict, @"body"); return pigeonResult; } ++ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKScriptMessageData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"name" : (self.name ?: [NSNull null]), @@ -383,8 +401,8 @@ - (NSDictionary *)toMap { @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; @@ -397,6 +415,7 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } ++ (nullable FWFNSHttpCookieData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSHttpCookieData fromMap:dict] : nil; } - (NSDictionary *)toMap { return @{ @"propertyKeys" : (self.propertyKeys ?: [NSNull null]), @@ -408,13 +427,15 @@ - (NSDictionary *)toMap { @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 @@ -422,11 +443,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]; } } @@ -447,52 +470,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(createDefaultDataStoreWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -500,36 +514,30 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], - @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " - @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_identifier - ofTypes:arg_dataTypes - modifiedSince:arg_modificationTimeInSecondsSinceEpoch - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -559,26 +567,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) { + +void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *api) { { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setBackgroundColor" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier: - toValue:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setBackgroundColorForViewWithIdentifier:toValue:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setBackgroundColorForViewWithIdentifier:toValue:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -587,20 +591,19 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec()]; + codec:FWFUIViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], - @"FWFUIViewHostApi api (%@) doesn't respond to " - @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -609,7 +612,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -639,72 +643,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier - webViewIdentifier:arg_webViewIdentifier - error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier - error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(scrollByForScrollViewWithIdentifier:x:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -714,34 +709,30 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec()]; + codec:FWFUIScrollViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], - @"FWFUIScrollViewHostApi api (%@) doesn't respond to " - @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_identifier - toX:arg_x - y:arg_y - error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -749,13 +740,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 @@ -763,11 +756,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]; } } @@ -788,25 +783,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -814,104 +806,146 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: - webViewIdentifier:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier - webViewIdentifier:arg_webViewIdentifier - error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier - isAllowed:arg_allow - error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." - @"setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec()]; + codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: - forTypes:error:)], - @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " - @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier - forTypes:arg_types - error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier forTypes:arg_types error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } } +@interface FWFWKWebViewConfigurationFlutterApiCodecReader : FlutterStandardReader +@end +@implementation FWFWKWebViewConfigurationFlutterApiCodecReader +@end + +@interface FWFWKWebViewConfigurationFlutterApiCodecWriter : FlutterStandardWriter +@end +@implementation FWFWKWebViewConfigurationFlutterApiCodecWriter +@end + +@interface FWFWKWebViewConfigurationFlutterApiCodecReaderWriter : FlutterStandardReaderWriter +@end +@implementation FWFWKWebViewConfigurationFlutterApiCodecReaderWriter +- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { + return [[FWFWKWebViewConfigurationFlutterApiCodecWriter alloc] initWithData:data]; +} +- (FlutterStandardReader *)readerWithData:(NSData *)data { + return [[FWFWKWebViewConfigurationFlutterApiCodecReader alloc] initWithData:data]; +} +@end + +NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec() { + static dispatch_once_t sPred = 0; + static FlutterStandardMessageCodec *sSharedObject = nil; + dispatch_once(&sPred, ^{ + FWFWKWebViewConfigurationFlutterApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationFlutterApiCodecReaderWriter alloc] init]; + sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; + }); + return sSharedObject; +} + + +@interface FWFWKWebViewConfigurationFlutterApi () +@property (nonatomic, strong) NSObject *binaryMessenger; +@end + +@implementation FWFWKWebViewConfigurationFlutterApi + +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { + self = [super init]; + if (self) { + _binaryMessenger = binaryMessenger; + } + return self; +} +- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create" + binaryMessenger:self.binaryMessenger + codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +@end @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -919,14 +953,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]; } } @@ -947,109 +984,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addScriptMessageHandlerForControllerWithIdentifier: - handlerIdentifier:ofName:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" - @"ofName:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier - handlerIdentifier:arg_handlerIdentifier - ofName:arg_name - error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier handlerIdentifier:arg_handlerIdentifier ofName:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier - name:arg_name - error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier name:arg_name error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1057,46 +1071,40 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: - userScript:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", - api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_identifier - userScript:arg_userScript - error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_identifier userScript:arg_userScript error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec()]; + codec:FWFWKUserContentControllerHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (removeAllUserScriptsForControllerWithIdentifier:error:)], - @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " - @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1104,7 +1112,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1134,63 +1143,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec()]; + codec:FWFWKPreferencesHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], - @"FWFWKPreferencesHostApi api (%@) doesn't respond to " - @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier - isEnabled:arg_enabled - error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1220,25 +1219,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1246,7 +1242,8 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1254,13 +1251,15 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess @interface FWFWKScriptMessageHandlerFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1268,11 +1267,13 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKScriptMessageHandlerFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1293,15 +1294,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFWKScriptMessageHandlerFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKScriptMessageHandlerFlutterApi @@ -1313,23 +1314,15 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier - userContentControllerIdentifier: - (NSNumber *)arg_userContentControllerIdentifier - message:(FWFWKScriptMessageData *)arg_message - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" - binaryMessenger:self.binaryMessenger - codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], - arg_message ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" + binaryMessenger:self.binaryMessenger + codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], arg_message ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKNavigationDelegateHostApiCodecReader : FlutterStandardReader @@ -1357,25 +1350,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1383,7 +1373,8 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1391,25 +1382,27 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen @interface FWFWKNavigationDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKNavigationDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1417,23 +1410,29 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKNavigationDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKNavigationDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1454,15 +1453,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 @@ -1474,124 +1473,80 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - URL:(nullable NSString *)arg_url - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - URL:(nullable NSString *)arg_url - completion: - (void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - navigationAction: - (FWFWKNavigationActionData *)arg_navigationAction - completion: - (void (^)(FWFWKNavigationActionPolicyEnumData - *_Nullable, - NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_navigationAction ?: [NSNull null] - ] - reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); - }]; -} -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - error:(FWFNSErrorData *)arg_error - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { + FWFWKNavigationActionPolicyEnumData *output = reply; + completion(output, nil); + }]; +} +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - error:(FWFNSErrorData *)arg_error - completion: - (void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier: - (NSNumber *)arg_webViewIdentifier - completion:(void (^)(NSError *_Nullable)) - completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName: - @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1599,11 +1554,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]; } } @@ -1624,25 +1581,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1650,67 +1604,53 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (addObserverForObjectWithIdentifier: - observerIdentifier:keyPath:options:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" - @"error:)", - api); + NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = - GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_identifier - observerIdentifier:arg_observerIdentifier - keyPath:arg_keyPath - options:arg_options - error:&error]; + [api addObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath options:arg_options error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec()]; + codec:FWFNSObjectHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: - observerIdentifier:keyPath:error:)], - @"FWFNSObjectHostApi api (%@) doesn't respond to " - @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", - api); + NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_identifier - observerIdentifier:arg_observerIdentifier - keyPath:arg_keyPath - error:&error]; + [api removeObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -1718,52 +1658,54 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, @interface FWFNSObjectFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 136: + + case 136: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 137: + + case 137: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - case 138: + + case 138: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - case 139: + + case 139: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 140: + + case 140: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 141: + + case 141: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1771,50 +1713,65 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFNSObjectFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else + if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1835,15 +1792,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = - [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; + FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFNSObjectFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFNSObjectFlutterApi @@ -1855,76 +1812,78 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier - keyPath:(NSString *)arg_keyPath - objectIdentifier:(NSNumber *)arg_objectIdentifier - changeKeys: - (NSArray *)arg_changeKeys - changeValues:(NSArray *)arg_changeValues - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier keyPath:(NSString *)arg_keyPath objectIdentifier:(NSNumber *)arg_objectIdentifier changeKeys:(NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.observeValue" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], - arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], - arg_changeValues ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; +} +- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel + messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.dispose" + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 136: + + case 136: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 137: + + case 137: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - case 138: + + case 138: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - case 139: + + case 139: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 140: + + case 140: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 141: + + case 141: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -1932,50 +1891,65 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else + if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else + if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else + if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else + if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -1996,101 +1970,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_identifier - configurationIdentifier:arg_configurationIdentifier - error:&error]; + [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_identifier - delegateIdentifier:arg_uiDelegateIdentifier - error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_uiDelegateIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: - delegateIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier - delegateIdentifier:arg_navigationDelegateIdentifier - error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_navigationDelegateIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(URLForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2098,44 +2056,39 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: - error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier - error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: - request:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2144,75 +2097,63 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: - HTMLString:baseURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_identifier - HTMLString:arg_string - baseURL:arg_baseUrl - error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_identifier HTMLString:arg_string baseURL:arg_baseUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_identifier - fileURL:arg_url - readAccessURL:arg_readAccessUrl - error:&error]; + [api loadFileForWebViewWithIdentifier:arg_identifier fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: - assetKey:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", - api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2221,20 +2162,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2242,20 +2182,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(canGoForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2263,20 +2202,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goBackForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2284,20 +2222,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(goForwardForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2305,20 +2242,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(reloadWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2326,20 +2262,19 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(titleForWebViewWithIdentifier:error:)", - api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2347,85 +2282,71 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector - (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier - isAllowed:arg_allow - error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: - userAgent:error:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", - api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_identifier - userAgent:arg_userAgent - error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_identifier userAgent:arg_userAgent error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec()]; + codec:FWFWKWebViewHostApiGetCodec() ]; if (api) { - NSCAssert( - [api respondsToSelector:@selector - (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], - @"FWFWKWebViewHostApi api (%@) doesn't respond to " - @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier - javaScriptString:arg_javaScriptString - completion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2455,25 +2376,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -2481,7 +2399,8 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } @@ -2489,19 +2408,21 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, @interface FWFWKUIDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKUIDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2509,17 +2430,21 @@ - (nullable id)readValueOfType:(UInt8)type { @interface FWFWKUIDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUIDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value { +- (void)writeValue:(id)value +{ if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else + if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else + if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else { + } else +{ [super writeValue:value]; } } @@ -2540,15 +2465,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = - [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } + @interface FWFWKUIDelegateFlutterApi () -@property(nonatomic, strong) NSObject *binaryMessenger; +@property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKUIDelegateFlutterApi @@ -2560,37 +2485,32 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - configurationIdentifier:(NSNumber *)arg_configurationIdentifier - navigationAction:(FWFWKNavigationActionData *)arg_navigationAction - completion:(void (^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier configurationIdentifier:(NSNumber *)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type +{ switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; + } } @end @@ -2598,14 +2518,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]; } } @@ -2626,62 +2549,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_identifier - dataStoreIdentifier:arg_websiteDataStoreIdentifier - error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier error:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec()]; + codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: - cookie:completion:)], - @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " - @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_identifier - cookie:arg_cookie - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } else { + } + else { [channel setMessageHandler:nil]; } } 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 c1971f09d068..3f7618493f67 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.pigeon.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v3.1.4), do not edit directly. +// Autogenerated from Pigeon (v3.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name // @dart = 2.12 @@ -94,7 +94,8 @@ class NSKeyValueObservingOptionsEnumData { static NSKeyValueObservingOptionsEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSKeyValueObservingOptionsEnumData( - value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int], + value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int] +, ); } } @@ -115,7 +116,8 @@ class NSKeyValueChangeKeyEnumData { static NSKeyValueChangeKeyEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSKeyValueChangeKeyEnumData( - value: NSKeyValueChangeKeyEnum.values[pigeonMap['value']! as int], + value: NSKeyValueChangeKeyEnum.values[pigeonMap['value']! as int] +, ); } } @@ -136,7 +138,8 @@ class WKUserScriptInjectionTimeEnumData { static WKUserScriptInjectionTimeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKUserScriptInjectionTimeEnumData( - value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int], + value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int] +, ); } } @@ -157,7 +160,8 @@ class WKAudiovisualMediaTypeEnumData { static WKAudiovisualMediaTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKAudiovisualMediaTypeEnumData( - value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int], + value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int] +, ); } } @@ -178,7 +182,8 @@ class WKWebsiteDataTypeEnumData { static WKWebsiteDataTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKWebsiteDataTypeEnumData( - value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int], + value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int] +, ); } } @@ -199,7 +204,8 @@ class WKNavigationActionPolicyEnumData { static WKNavigationActionPolicyEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKNavigationActionPolicyEnumData( - value: WKNavigationActionPolicyEnum.values[pigeonMap['value']! as int], + value: WKNavigationActionPolicyEnum.values[pigeonMap['value']! as int] +, ); } } @@ -220,7 +226,8 @@ class NSHttpCookiePropertyKeyEnumData { static NSHttpCookiePropertyKeyEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookiePropertyKeyEnumData( - value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int], + value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int] +, ); } } @@ -253,9 +260,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(), ); } } @@ -284,8 +289,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, ); @@ -311,8 +315,10 @@ class WKNavigationActionData { static WKNavigationActionData decode(Object message) { final Map pigeonMap = message as Map; return WKNavigationActionData( - request: NSUrlRequestData.decode(pigeonMap['request']!), - targetFrame: WKFrameInfoData.decode(pigeonMap['targetFrame']!), + request: NSUrlRequestData.decode(pigeonMap['request']!) +, + targetFrame: WKFrameInfoData.decode(pigeonMap['targetFrame']!) +, ); } } @@ -411,10 +417,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(), ); } } @@ -426,19 +430,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); + } } } @@ -447,30 +452,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_configurationIdentifier]) 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,9 +482,7 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -494,8 +491,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?, @@ -506,26 +502,18 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes( - int arg_identifier, - List arg_dataTypes, - double arg_modificationTimeInSecondsSinceEpoch) async { + Future removeDataOfTypes(int arg_identifier, List arg_dataTypes, double arg_modificationTimeInSecondsSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_identifier, - arg_dataTypes, - arg_modificationTimeInSecondsSinceEpoch - ]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch]) 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?, @@ -550,8 +538,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; @@ -559,18 +546,16 @@ class UIViewHostApi { Future setBackgroundColor(int arg_identifier, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -583,18 +568,16 @@ class UIViewHostApi { Future setOpaque(int arg_identifier, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -614,29 +597,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_identifier, int arg_webViewIdentifier) async { + Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_webViewIdentifier]) - as Map?; + await channel.send([arg_identifier, arg_webViewIdentifier]) 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?, @@ -649,8 +627,7 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -659,8 +636,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?, @@ -678,19 +654,16 @@ class UIScrollViewHostApi { Future scrollBy(int arg_identifier, 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_identifier, arg_x, arg_y]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -701,22 +674,18 @@ class UIScrollViewHostApi { } } - Future setContentOffset( - int arg_identifier, double arg_x, double arg_y) async { + Future setContentOffset(int arg_identifier, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_x, arg_y]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -735,19 +704,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); + } } } @@ -756,18 +726,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -776,8 +743,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?, @@ -788,23 +754,18 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView( - int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_webViewIdentifier]) - as Map?; + await channel.send([arg_identifier, arg_webViewIdentifier]) 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?, @@ -815,22 +776,18 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback( - int arg_identifier, bool arg_allow) async { + Future setAllowsInlineMediaPlayback(int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -841,22 +798,18 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, - List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -868,6 +821,33 @@ class WKWebViewConfigurationHostApi { } } +class _WKWebViewConfigurationFlutterApiCodec extends StandardMessageCodec { + const _WKWebViewConfigurationFlutterApiCodec(); +} +abstract class WKWebViewConfigurationFlutterApi { + static const MessageCodec codec = _WKWebViewConfigurationFlutterApiCodec(); + + void create(int identifier); + static void setup(WKWebViewConfigurationFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create', codec, binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + class _WKUserContentControllerHostApiCodec extends StandardMessageCodec { const _WKUserContentControllerHostApiCodec(); @override @@ -875,25 +855,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); + } } } @@ -902,31 +884,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_configurationIdentifier]) 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?, @@ -937,23 +912,18 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler( - int arg_identifier, int arg_handlerIdentifier, String arg_name) async { + Future addScriptMessageHandler(int arg_identifier, int arg_handlerIdentifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_handlerIdentifier, arg_name]) - as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_handlerIdentifier, 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?, @@ -964,22 +934,18 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler( - int arg_identifier, String arg_name) async { + Future removeScriptMessageHandler(int arg_identifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -992,9 +958,7 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1003,8 +967,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?, @@ -1015,23 +978,18 @@ class WKUserContentControllerHostApi { } } - Future addUserScript( - int arg_identifier, WKUserScriptData arg_userScript) async { + Future addUserScript(int arg_identifier, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', - codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_userScript]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -1044,9 +1002,7 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1055,8 +1011,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?, @@ -1076,30 +1031,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_configurationIdentifier]) 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?, @@ -1110,21 +1059,18 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled( - int arg_identifier, bool arg_enabled) async { + Future setJavaScriptEnabled(int arg_identifier, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -1144,18 +1090,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1164,8 +1107,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?, @@ -1184,55 +1126,44 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { if (value is WKScriptMessageData) { 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 WKScriptMessageData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class WKScriptMessageHandlerFlutterApi { - static const MessageCodec codec = - _WKScriptMessageHandlerFlutterApiCodec(); + static const MessageCodec codec = _WKScriptMessageHandlerFlutterApiCodec(); - void didReceiveScriptMessage(int identifier, - int userContentControllerIdentifier, WKScriptMessageData message); - static void setup(WKScriptMessageHandlerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void didReceiveScriptMessage(int identifier, int userContentControllerIdentifier, WKScriptMessageData message); + static void setup(WKScriptMessageHandlerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); final int? arg_userContentControllerIdentifier = (args[1] as int?); - assert(arg_userContentControllerIdentifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); - final WKScriptMessageData? arg_message = - (args[2] as WKScriptMessageData?); - assert(arg_message != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, - arg_userContentControllerIdentifier!, arg_message!); + assert(arg_userContentControllerIdentifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + final WKScriptMessageData? arg_message = (args[2] as WKScriptMessageData?); + assert(arg_message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); + api.didReceiveScriptMessage(arg_identifier!, arg_userContentControllerIdentifier!, arg_message!); return; }); } @@ -1248,18 +1179,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1268,8 +1196,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?, @@ -1288,219 +1215,173 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else + if (value is WKFrameInfoData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else + if (value is WKNavigationActionData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else + if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSUrlRequestData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKFrameInfoData.decode(readValue(buffer)!); - - case 131: + + case 131: return WKNavigationActionData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = - _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); void didFinishNavigation(int identifier, int webViewIdentifier, String? url); - void didStartProvisionalNavigation( - int identifier, int webViewIdentifier, String? url); - Future decidePolicyForNavigationAction( - int identifier, - int webViewIdentifier, - WKNavigationActionData navigationAction); - void didFailNavigation( - int identifier, int webViewIdentifier, NSErrorData error); - void didFailProvisionalNavigation( - int identifier, int webViewIdentifier, NSErrorData error); - void webViewWebContentProcessDidTerminate( - int identifier, int webViewIdentifier); - static void setup(WKNavigationDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void didStartProvisionalNavigation(int identifier, int webViewIdentifier, String? url); + Future decidePolicyForNavigationAction(int identifier, int webViewIdentifier, WKNavigationActionData navigationAction); + void didFailNavigation(int identifier, int webViewIdentifier, NSErrorData error); + void didFailProvisionalNavigation(int identifier, int webViewIdentifier, NSErrorData error); + void webViewWebContentProcessDidTerminate(int identifier, int webViewIdentifier); + static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didFinishNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didStartProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = - (args[2] as WKNavigationActionData?); - assert(arg_navigationAction != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = - await api.decidePolicyForNavigationAction(arg_identifier!, - arg_webViewIdentifier!, arg_navigationAction!); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = (args[2] as WKNavigationActionData?); + assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); + final WKNavigationActionPolicyEnumData output = await api.decidePolicyForNavigationAction(arg_identifier!, arg_webViewIdentifier!, arg_navigationAction!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); + api.didFailNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); + api.didFailProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', - codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate( - arg_identifier!, arg_webViewIdentifier!); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + api.webViewWebContentProcessDidTerminate(arg_identifier!, arg_webViewIdentifier!); return; }); } @@ -1515,19 +1396,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); + } } } @@ -1536,8 +1418,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; @@ -1545,8 +1426,7 @@ class NSObjectHostApi { Future dispose(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1555,8 +1435,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?, @@ -1567,28 +1446,18 @@ class NSObjectHostApi { } } - Future addObserver( - int arg_identifier, - int arg_observerIdentifier, - String arg_keyPath, - List arg_options) async { + Future addObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath, List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ - arg_identifier, - arg_observerIdentifier, - arg_keyPath, - arg_options - ]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_observerIdentifier, 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?, @@ -1599,22 +1468,18 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_identifier, int arg_observerIdentifier, - String arg_keyPath) async { + Future removeObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( - [arg_identifier, arg_observerIdentifier, arg_keyPath]) - as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_observerIdentifier, 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?, @@ -1633,142 +1498,156 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else + if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { + } else + if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else + if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else + if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else + if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else + if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class NSObjectFlutterApi { static const MessageCodec codec = _NSObjectFlutterApiCodec(); - void observeValue( - int identifier, - String keyPath, - int objectIdentifier, - List changeKeys, - List changeValues); - static void setup(NSObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void observeValue(int identifier, String keyPath, int objectIdentifier, List changeKeys, List changeValues); + void dispose(int identifier); + static void setup(NSObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); final String? arg_keyPath = (args[1] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); final int? arg_objectIdentifier = (args[2] as int?); - assert(arg_objectIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); - final List? arg_changeKeys = - (args[3] as List?)?.cast(); - assert(arg_changeKeys != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - final List? arg_changeValues = - (args[4] as List?)?.cast(); - assert(arg_changeValues != null, - 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, - arg_changeKeys!, arg_changeValues!); + assert(arg_objectIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + final List? arg_changeKeys = (args[3] as List?)?.cast(); + assert(arg_changeKeys != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + final List? arg_changeValues = (args[4] as List?)?.cast(); + assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.NSObjectFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); + api.dispose(arg_identifier!); return; }); } @@ -1783,97 +1662,111 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else + if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { + } else + if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else + if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else + if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else + if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else + if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } @@ -1882,29 +1775,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_identifier, int arg_configurationIdentifier) async { + Future create(int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_configurationIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_configurationIdentifier]) 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?, @@ -1915,22 +1803,18 @@ class WKWebViewHostApi { } } - Future setUIDelegate( - int arg_identifier, int? arg_uiDelegateIdentifier) async { + Future setUIDelegate(int arg_identifier, int? arg_uiDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_uiDelegateIdentifier]) - as Map?; + await channel.send([arg_identifier, arg_uiDelegateIdentifier]) 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?, @@ -1941,22 +1825,18 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate( - int arg_identifier, int? arg_navigationDelegateIdentifier) async { + Future setNavigationDelegate(int arg_identifier, int? arg_navigationDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_navigationDelegateIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_navigationDelegateIdentifier]) 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?, @@ -1969,8 +1849,7 @@ class WKWebViewHostApi { Future getUrl(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1979,8 +1858,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?, @@ -1993,8 +1871,7 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2003,8 +1880,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?, @@ -2020,21 +1896,18 @@ class WKWebViewHostApi { } } - Future loadRequest( - int arg_identifier, NSUrlRequestData arg_request) async { + Future loadRequest(int arg_identifier, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -2045,22 +1918,18 @@ class WKWebViewHostApi { } } - Future loadHtmlString( - int arg_identifier, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString(int arg_identifier, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_string, arg_baseUrl]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -2071,22 +1940,18 @@ class WKWebViewHostApi { } } - Future loadFileUrl( - int arg_identifier, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl(int arg_identifier, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_url, arg_readAccessUrl]) - as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -2099,18 +1964,16 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_identifier, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -2123,8 +1986,7 @@ class WKWebViewHostApi { Future canGoBack(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2133,8 +1995,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?, @@ -2152,8 +2013,7 @@ class WKWebViewHostApi { Future canGoForward(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2162,8 +2022,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?, @@ -2181,8 +2040,7 @@ class WKWebViewHostApi { Future goBack(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2191,8 +2049,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?, @@ -2205,8 +2062,7 @@ class WKWebViewHostApi { Future goForward(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2215,8 +2071,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?, @@ -2229,8 +2084,7 @@ class WKWebViewHostApi { Future reload(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2239,8 +2093,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?, @@ -2253,8 +2106,7 @@ class WKWebViewHostApi { Future getTitle(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2263,8 +2115,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?, @@ -2275,22 +2126,18 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures( - int arg_identifier, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures(int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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?, @@ -2301,22 +2148,18 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent( - int arg_identifier, String? arg_userAgent) async { + Future setCustomUserAgent(int arg_identifier, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_userAgent]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -2327,22 +2170,18 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript( - int arg_identifier, String arg_javaScriptString) async { + Future evaluateJavaScript(int arg_identifier, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, - binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_javaScriptString]) - as Map?; + await channel.send([arg_identifier, 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?, @@ -2362,8 +2201,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; @@ -2371,8 +2209,7 @@ class WKUIDelegateHostApi { Future create(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2381,8 +2218,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?, @@ -2401,68 +2237,60 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { if (value is NSUrlRequestData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else + if (value is WKFrameInfoData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else + if (value is WKNavigationActionData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSUrlRequestData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKFrameInfoData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKNavigationActionData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class WKUIDelegateFlutterApi { static const MessageCodec codec = _WKUIDelegateFlutterApiCodec(); - void onCreateWebView(int identifier, int webViewIdentifier, - int configurationIdentifier, WKNavigationActionData navigationAction); - static void setup(WKUIDelegateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + void onCreateWebView(int identifier, int webViewIdentifier, int configurationIdentifier, WKNavigationActionData navigationAction); + static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); + assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[2] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = - (args[3] as WKNavigationActionData?); - assert(arg_navigationAction != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, - arg_configurationIdentifier!, arg_navigationAction!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = (args[3] as WKNavigationActionData?); + assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, arg_configurationIdentifier!, arg_navigationAction!); return; }); } @@ -2477,25 +2305,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); + } } } @@ -2504,30 +2334,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_identifier, int arg_websiteDataStoreIdentifier) async { + Future createFromWebsiteDataStore(int arg_identifier, int arg_websiteDataStoreIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_websiteDataStoreIdentifier]) - as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, arg_websiteDataStoreIdentifier]) 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?, @@ -2538,21 +2362,18 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie( - int arg_identifier, NSHttpCookieData arg_cookie) async { + Future setCookie(int arg_identifier, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, - binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel - .send([arg_identifier, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); + final Map? replyMap = + await channel.send([arg_identifier, 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_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart index 949822006bc5..d2310e0a5df8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart @@ -89,7 +89,6 @@ class FoundationFlutterApis { } /// Host api implementation for [NSObject]. -@immutable class NSObjectHostApiImpl extends NSObjectHostApi { /// Constructs an [NSObjectHostApiImpl]. NSObjectHostApiImpl({ @@ -137,7 +136,6 @@ class NSObjectHostApiImpl extends NSObjectHostApi { } /// Flutter api implementation for [NSObject]. -@immutable class NSObjectFlutterApiImpl extends NSObjectFlutterApi { /// Constructs a [NSObjectFlutterApiImpl]. NSObjectFlutterApiImpl({InstanceManager? instanceManager}) @@ -172,4 +170,9 @@ class NSObjectFlutterApiImpl extends NSObjectFlutterApi { ), changeValues), ); } + + @override + void dispose(int identifier) { + instanceManager.remove(identifier); + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart index c9f50c5d808c..6a54166fbad8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit_api_impls.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'dart:math'; -import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart' show Color; import 'package:flutter/services.dart'; @@ -17,7 +16,6 @@ import '../web_kit/web_kit.dart'; import 'ui_kit.dart'; /// Host api implementation for [UIScrollView]. -@immutable class UIScrollViewHostApiImpl extends UIScrollViewHostApi { /// Constructs a [UIScrollViewHostApiImpl]. UIScrollViewHostApiImpl({ @@ -82,7 +80,6 @@ class UIScrollViewHostApiImpl extends UIScrollViewHostApi { } /// Host api implementation for [UIView]. -@immutable class UIViewHostApiImpl extends UIViewHostApi { /// Constructs a [UIViewHostApiImpl]. UIViewHostApiImpl({ 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 7a4fc44c9e91..51331c47fdd9 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 @@ -243,6 +243,10 @@ class WebKitFlutterApis { ), uiDelegate = WKUIDelegateFlutterApiImpl( instanceManager: instanceManager, + ), + webViewConfiguration = WKWebViewConfigurationFlutterApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, ); static WebKitFlutterApis _instance = WebKitFlutterApis(); @@ -273,6 +277,9 @@ class WebKitFlutterApis { @visibleForTesting final WKUIDelegateFlutterApiImpl uiDelegate; + /// Flutter Api for [WKWebViewConfiguration]. + final WKWebViewConfigurationFlutterApiImpl webViewConfiguration; + /// Ensures all the Flutter APIs have been set up to receive calls from native code. void ensureSetUp() { if (!_hasBeenSetUp) { @@ -288,13 +295,16 @@ class WebKitFlutterApis { uiDelegate, binaryMessenger: _binaryMessenger, ); + WKWebViewConfigurationFlutterApi.setup( + webViewConfiguration, + binaryMessenger: _binaryMessenger, + ); _hasBeenSetUp = true; } } } /// Host api implementation for [WKWebSiteDataStore]. -@immutable class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { /// Constructs a [WebsiteDataStoreHostApiImpl]. WKWebsiteDataStoreHostApiImpl({ @@ -347,7 +357,6 @@ class WKWebsiteDataStoreHostApiImpl extends WKWebsiteDataStoreHostApi { } /// Host api implementation for [WKScriptMessageHandler]. -@immutable class WKScriptMessageHandlerHostApiImpl extends WKScriptMessageHandlerHostApi { /// Constructs a [WKScriptMessageHandlerHostApiImpl]. WKScriptMessageHandlerHostApiImpl({ @@ -372,7 +381,6 @@ class WKScriptMessageHandlerHostApiImpl extends WKScriptMessageHandlerHostApi { } /// Flutter api implementation for [WKScriptMessageHandler]. -@immutable class WKScriptMessageHandlerFlutterApiImpl extends WKScriptMessageHandlerFlutterApi { /// Constructs a [WKScriptMessageHandlerFlutterApiImpl]. @@ -402,7 +410,6 @@ class WKScriptMessageHandlerFlutterApiImpl } /// Host api implementation for [WKPreferences]. -@immutable class WKPreferencesHostApiImpl extends WKPreferencesHostApi { /// Constructs a [WKPreferencesHostApiImpl]. WKPreferencesHostApiImpl({ @@ -444,7 +451,6 @@ class WKPreferencesHostApiImpl extends WKPreferencesHostApi { } /// Host api implementation for [WKHttpCookieStore]. -@immutable class WKHttpCookieStoreHostApiImpl extends WKHttpCookieStoreHostApi { /// Constructs a [WKHttpCookieStoreHostApiImpl]. WKHttpCookieStoreHostApiImpl({ @@ -486,7 +492,6 @@ class WKHttpCookieStoreHostApiImpl extends WKHttpCookieStoreHostApi { } /// Host api implementation for [WKUserContentController]. -@immutable class WKUserContentControllerHostApiImpl extends WKUserContentControllerHostApi { /// Constructs a [WKUserContentControllerHostApiImpl]. @@ -569,7 +574,6 @@ class WKUserContentControllerHostApiImpl } /// Host api implementation for [WKWebViewConfiguration]. -@immutable class WKWebViewConfigurationHostApiImpl extends WKWebViewConfigurationHostApi { /// Constructs a [WKWebViewConfigurationHostApiImpl]. WKWebViewConfigurationHostApiImpl({ @@ -626,8 +630,38 @@ class WKWebViewConfigurationHostApiImpl extends WKWebViewConfigurationHostApi { } } -/// Host api implementation for [WKUIDelegate]. +/// Flutter api implementation for [WKWebViewConfiguration]. @immutable +class WKWebViewConfigurationFlutterApiImpl + extends WKWebViewConfigurationFlutterApi { + /// Constructs a [WKWebViewConfigurationFlutterApiImpl]. + WKWebViewConfigurationFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + WKWebViewConfiguration.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} + +/// Host api implementation for [WKUIDelegate]. class WKUIDelegateHostApiImpl extends WKUIDelegateHostApi { /// Constructs a [WKUIDelegateHostApiImpl]. WKUIDelegateHostApiImpl({ @@ -652,7 +686,6 @@ class WKUIDelegateHostApiImpl extends WKUIDelegateHostApi { } /// Flutter api implementation for [WKUIDelegate]. -@immutable class WKUIDelegateFlutterApiImpl extends WKUIDelegateFlutterApi { /// Constructs a [WKUIDelegateFlutterApiImpl]. WKUIDelegateFlutterApiImpl({InstanceManager? instanceManager}) @@ -685,7 +718,6 @@ class WKUIDelegateFlutterApiImpl extends WKUIDelegateFlutterApi { } /// Host api implementation for [WKNavigationDelegate]. -@immutable class WKNavigationDelegateHostApiImpl extends WKNavigationDelegateHostApi { /// Constructs a [WKNavigationDelegateHostApiImpl]. WKNavigationDelegateHostApiImpl({ @@ -710,7 +742,6 @@ class WKNavigationDelegateHostApiImpl extends WKNavigationDelegateHostApi { } /// Flutter api implementation for [WKNavigationDelegate]. -@immutable class WKNavigationDelegateFlutterApiImpl extends WKNavigationDelegateFlutterApi { /// Constructs a [WKNavigationDelegateFlutterApiImpl]. @@ -824,7 +855,6 @@ class WKNavigationDelegateFlutterApiImpl } /// Host api implementation for [WKWebView]. -@immutable class WKWebViewHostApiImpl extends WKWebViewHostApi { /// Constructs a [WKWebViewHostApiImpl]. WKWebViewHostApiImpl({ 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 e46dafa01a62..c20a10ebfadd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -312,6 +312,15 @@ abstract class WKWebViewConfigurationHostApi { ); } +/// Handles callbacks from an WKWebViewConfiguration instance. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. +@FlutterApi() +abstract class WKWebViewConfigurationFlutterApi { + @ObjCSelector('createWithIdentifier:') + void create(int identifier); +} + /// Mirror of WKUserContentController. /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @@ -501,6 +510,9 @@ abstract class NSObjectFlutterApi { List changeKeys, List changeValues, ); + + @ObjCSelector('disposeObjectWithIdentifier:') + void dispose(int identifier); } /// Mirror of WKWebView. 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 5bf50e2b9850..8fd67e036afa 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v3.1.4), do not edit directly. +// Autogenerated from Pigeon (v3.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis // ignore_for_file: avoid_relative_lib_imports @@ -12,7 +12,7 @@ import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:webview_flutter_wkwebview/src/common/web_kit.pigeon.dart'; +import '../../../lib/src/common/web_kit.pigeon.dart'; class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _TestWKWebsiteDataStoreHostApiCodec(); @@ -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 identifier, int configurationIdentifier); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); void createDefaultDataStore(int identifier); - Future removeDataOfTypes( - int identifier, - List dataTypes, - double modificationTimeInSecondsSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes(int identifier, List dataTypes, double modificationTimeInSecondsSinceEpoch); + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', - codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_identifier!); return {}; }); @@ -97,29 +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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = - (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); - final double? arg_modificationTimeInSecondsSinceEpoch = - (args[2] as double?); - assert(arg_modificationTimeInSecondsSinceEpoch != null, - 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, - arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + final double? arg_modificationTimeInSecondsSinceEpoch = (args[2] as double?); + assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_identifier!, arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); return {'result': output}; }); } @@ -130,28 +105,23 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } - abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); void setBackgroundColor(int identifier, int? value); void setOpaque(int identifier, bool opaque); - static void setup(TestUIViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_identifier!, arg_value); return {}; @@ -160,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, - 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_identifier!, arg_opaque!); return {}; }); @@ -186,7 +152,6 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } - abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -194,25 +159,20 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int identifier); void scrollBy(int identifier, double x, double y); void setContentOffset(int identifier, double x, double y); - static void setup(TestUIScrollViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return {}; }); @@ -220,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_identifier!); return {'result': output}; }); @@ -239,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_identifier!, arg_x!, arg_y!); return {}; }); @@ -264,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, - 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_identifier!, arg_x!, arg_y!); return {}; }); @@ -297,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 identifier); void createFromWebView(int identifier, int webViewIdentifier); void setAllowsInlineMediaPlayback(int identifier, bool allow); - void setMediaTypesRequiringUserActionForPlayback( - int identifier, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, - {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback(int identifier, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -346,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return {}; }); @@ -369,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); return {}; }); @@ -392,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = - (args[1] as List?) - ?.cast(); - assert(arg_types != null, - 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_identifier!, arg_types!); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = (args[1] as List?)?.cast(); + assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback(arg_identifier!, arg_types!); return {}; }); } @@ -426,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 identifier, int configurationIdentifier); - void addScriptMessageHandler( - int identifier, int handlerIdentifier, String name); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); + void addScriptMessageHandler(int identifier, int handlerIdentifier, String name); void removeScriptMessageHandler(int identifier, String name); void removeAllScriptMessageHandlers(int identifier); void addUserScript(int identifier, WKUserScriptData userScript); void removeAllUserScripts(int identifier); - static void setup(TestWKUserContentControllerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', - codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerIdentifier = (args[1] as int?); - assert(arg_handlerIdentifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_identifier!, arg_handlerIdentifier!, arg_name!); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler(arg_identifier!, arg_handlerIdentifier!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', - codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_identifier!, arg_name!); return {}; }); @@ -539,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_identifier!); return {}; }); @@ -559,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = - (args[1] as WKUserScriptData?); - assert(arg_userScript != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); + assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_identifier!, arg_userScript!); return {}; }); @@ -583,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_identifier!); return {}; }); @@ -607,56 +495,43 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } - abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration( - int identifier, int configurationIdentifier); + void createFromWebViewConfiguration(int identifier, int configurationIdentifier); void setJavaScriptEnabled(int identifier, bool enabled); - static void setup(TestWKPreferencesHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', - codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); return {}; }); @@ -668,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 identifier); - static void setup(TestWKScriptMessageHandlerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -701,28 +570,22 @@ 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 identifier); - static void setup(TestWKNavigationDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -738,46 +601,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 identifier); - void addObserver(int identifier, int observerIdentifier, String keyPath, - List options); + void addObserver(int identifier, int observerIdentifier, String keyPath, List options); void removeObserver(int identifier, int observerIdentifier, String keyPath); - static void setup(TestNSObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return {}; }); @@ -785,57 +643,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = - (args[3] as List?) - ?.cast(); - assert(arg_options != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, - arg_keyPath!, arg_options!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = (args[3] as List?)?.cast(); + assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!, arg_options!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, - 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!); return {}; }); } @@ -850,101 +693,114 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookieData) { + } else + if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is NSHttpCookiePropertyKeyEnumData) { + } else + if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueChangeKeyEnumData) { + } else + if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NSKeyValueObservingOptionsEnumData) { + } else + if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NSUrlRequestData) { + } else + if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is WKAudiovisualMediaTypeEnumData) { + } else + if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is WKFrameInfoData) { + } else + if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionData) { + } else + if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is WKNavigationActionPolicyEnumData) { + } else + if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is WKScriptMessageData) { + } else + if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptData) { + } else + if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is WKUserScriptInjectionTimeEnumData) { + } else + if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is WKWebsiteDataTypeEnumData) { + } else + if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else { + } else +{ super.writeValue(buffer, value); } } - @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); + } } } - abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -966,25 +822,20 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int identifier, bool allow); void setCustomUserAgent(int identifier, String? userAgent); Future evaluateJavaScript(int identifier, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_identifier!, arg_configurationIdentifier!); return {}; }); @@ -992,18 +843,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); return {}; @@ -1012,39 +860,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate( - arg_identifier!, arg_navigationDelegateIdentifier); + api.setNavigationDelegate(arg_identifier!, arg_navigationDelegateIdentifier); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_identifier!); return {'result': output}; }); @@ -1052,18 +893,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_identifier!); return {'result': output}; }); @@ -1071,21 +909,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_identifier!, arg_request!); return {}; }); @@ -1093,21 +927,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); return {}; @@ -1116,24 +946,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -1141,21 +966,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_identifier!, arg_key!); return {}; }); @@ -1163,18 +984,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_identifier!); return {'result': output}; }); @@ -1182,18 +1000,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_identifier!); return {'result': output}; }); @@ -1201,18 +1016,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_identifier!); return {}; }); @@ -1220,18 +1032,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_identifier!); return {}; }); @@ -1239,18 +1048,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_identifier!); return {}; }); @@ -1258,18 +1064,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_identifier!); return {'result': output}; }); @@ -1277,42 +1080,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_identifier!, arg_allow!); + assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures(arg_identifier!, arg_allow!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_identifier!, arg_userAgent); return {}; @@ -1321,23 +1115,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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, - 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_identifier!, arg_javaScriptString!); + assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript(arg_identifier!, arg_javaScriptString!); return {'result': output}; }); } @@ -1348,27 +1137,22 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } - abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int identifier); - static void setup(TestWKUIDelegateHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -1384,79 +1168,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 identifier, int websiteDataStoreIdentifier); + void createFromWebsiteDataStore(int identifier, int websiteDataStoreIdentifier); Future setCookie(int identifier, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', - codec, - 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreIdentifier = (args[1] as int?); - assert(arg_websiteDataStoreIdentifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_identifier!, arg_websiteDataStoreIdentifier!); + assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore(arg_identifier!, arg_websiteDataStoreIdentifier!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, - 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_identifier!, arg_cookie!); return {}; }); From bd635a78a31fe43863995c5171560e31f2536cf0 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:40:07 -0700 Subject: [PATCH 18/31] webviewconfiguration objc code --- .../ios/Classes/FWFUIDelegateHostApi.m | 9 ++++++++ .../Classes/FWFWebViewConfigurationHostApi.h | 12 ++++++++++ .../Classes/FWFWebViewConfigurationHostApi.m | 23 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index fa96ff2b8749..a0332b10d102 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -9,6 +9,7 @@ @interface FWFUIDelegateFlutterApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. +@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -17,6 +18,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen instanceManager:(FWFInstanceManager *)instanceManager { self = [self initWithBinaryMessenger:binaryMessenger]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; @@ -35,6 +37,13 @@ - (void)onCreateWebViewForDelegate:(FWFUIDelegate *)instance @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNavigationAction(navigationAction); + + if (![self.instanceManager containsInstance:configuration]) { + FWFWebViewConfigurationFlutterApiImpl *flutterApi = [[FWFWebViewConfigurationFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; + [flutterApi createWithConfiguration:configuration completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; + } [self onCreateWebViewForDelegateWithIdentifier:@([self identifierForDelegate:instance]) webViewIdentifier: @([self.instanceManager diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h index d062af1c9b18..56e9c5ac625d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -11,6 +11,18 @@ NS_ASSUME_NONNULL_BEGIN +/** + * Flutter api implementation for WKWebViewConfiguration. + * + * Handles making callbacks to Dart for a WKWebViewConfiguration. + */ +@interface FWFWebViewConfigurationFlutterApiImpl : FWFWKWebViewConfigurationFlutterApi +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager; +- (void)createWithConfiguration:(WKWebViewConfiguration *)configuration + completion:(void (^)(NSError * _Nullable))completion; +@end + @interface FWFWebViewConfiguration : WKWebViewConfiguration @property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; - (instancetype)initWithBinaryMessenger:(id)binaryMessenger 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 708213366ee9..e9600d45cc47 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -6,6 +6,29 @@ #import "FWFDataConverters.h" #import "FWFWebViewConfigurationHostApi.h" +@interface FWFWebViewConfigurationFlutterApiImpl () +// BinaryMessenger and InstanceManager must be weak to prevent a circular reference +// with the objects it stores. +@property(nonatomic, weak) FWFInstanceManager *instanceManager; +@end + +@implementation FWFWebViewConfigurationFlutterApiImpl +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + instanceManager:(FWFInstanceManager *)instanceManager { + self = [self initWithBinaryMessenger:binaryMessenger]; + if (self) { + _instanceManager = instanceManager; + } + return self; +} + +- (void)createWithConfiguration:(WKWebViewConfiguration *)configuration + completion:(void (^)(NSError * _Nullable))completion { + long identifier = [self.instanceManager addHostCreatedInstance:configuration]; + [self createWithIdentifier:@(identifier) completion:completion]; +} +@end + @implementation FWFWebViewConfiguration - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager { From 0cdcde3004cc828d7e75d5be5ad2323ebfd7d80e Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:40:29 -0700 Subject: [PATCH 19/31] formatting --- .../ios/Classes/FWFGeneratedWebKitApis.h | 343 +++- .../ios/Classes/FWFGeneratedWebKitApis.m | 1825 +++++++++-------- .../ios/Classes/FWFUIDelegateHostApi.m | 14 +- .../Classes/FWFWebViewConfigurationHostApi.h | 2 +- .../Classes/FWFWebViewConfigurationHostApi.m | 2 +- .../lib/src/common/web_kit.pigeon.dart | 1204 ++++++----- .../test/src/common/test_web_kit.pigeon.dart | 856 +++++--- 7 files changed, 2538 insertions(+), 1708 deletions(-) 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 9cda5d48631f..8cbd2c7c194c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -146,147 +146,209 @@ 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 FWFWKNavigationActionData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame; -@property(nonatomic, strong) FWFNSUrlRequestData * request; -@property(nonatomic, strong) FWFWKFrameInfoData * targetFrame; + targetFrame:(FWFWKFrameInfoData *)targetFrame; +@property(nonatomic, strong) FWFNSUrlRequestData *request; +@property(nonatomic, strong) FWFWKFrameInfoData *targetFrame; @end @interface FWFWKFrameInfoData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber * isMainFrame; +@property(nonatomic, strong) NSNumber *isMainFrame; @end @interface FWFNSErrorData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription; -@property(nonatomic, strong) NSNumber * code; -@property(nonatomic, copy) NSString * domain; -@property(nonatomic, copy) NSString * localizedDescription; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription; +@property(nonatomic, strong) NSNumber *code; +@property(nonatomic, copy) NSString *domain; +@property(nonatomic, copy) NSString *localizedDescription; @end @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name - body:(id )body; -@property(nonatomic, copy) NSString * name; -@property(nonatomic, strong) id body; ++ (instancetype)makeWithName:(NSString *)name body:(id)body; +@property(nonatomic, copy) NSString *name; +@property(nonatomic, strong) id body; @end @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 *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier ofTypes:(NSArray *)dataTypes modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch completion:(void(^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier + ofTypes:(NSArray *)dataTypes + modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch + completion:(void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebsiteDataStoreHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIViewHostApi. NSObject *FWFUIViewHostApiGetCodec(void); @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier isOpaque:(NSNumber *)opaque error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier + toValue:(nullable NSNumber *)value + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier + isOpaque:(NSNumber *)opaque + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. NSObject *FWFUIScrollViewHostApiGetCodec(void); @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSArray *)contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier x:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier toX:(NSNumber *)x y:(NSNumber *)y error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSArray *) + contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier + x:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + toX:(NSNumber *)x + y:(NSNumber *)y + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); @protocol FWFWKWebViewConfigurationHostApi - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier forTypes:(NSArray *)types error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier + isAllowed:(NSNumber *)allow + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void) + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier + forTypes: + (NSArray< + FWFWKAudiovisualMediaTypeEnumData + *> *)types + error: + (FlutterError *_Nullable *_Nonnull) + error; @end -extern void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewConfigurationHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationFlutterApi. NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void); @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +- (void)createWithIdentifier:(NSNumber *)identifier + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKUserContentControllerHostApi. NSObject *FWFWKUserContentControllerHostApiGetCodec(void); @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier handlerIdentifier:(NSNumber *)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier + handlerIdentifier:(NSNumber *)handlerIdentifier + ofName:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier + name:(NSString *)name + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable *_Nonnull) + error; +- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier + userScript:(FWFWKUserScriptData *)userScript + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUserContentControllerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKPreferencesHostApi. NSObject *FWFWKPreferencesHostApiGetCodec(void); @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier isEnabled:(NSNumber *)enabled error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier + isEnabled:(NSNumber *)enabled + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); @@ -295,14 +357,19 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKScriptMessageHandlerHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerFlutterApi. NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void); @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion:(void(^)(NSError *_Nullable))completion; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier + userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier + message:(FWFWKScriptMessageData *)message + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKNavigationDelegateHostApi. NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); @@ -311,67 +378,145 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKNavigationDelegateHostApiSetup( + id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKNavigationDelegateFlutterApi. NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier URL:(nullable NSString *)url completion:(void(^)(NSError *_Nullable))completion; -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier error:(FWFNSErrorData *)error completion:(void(^)(NSError *_Nullable))completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier completion:(void(^)(NSError *_Nullable))completion; +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + URL:(nullable NSString *)url + completion:(void (^)(NSError *_Nullable))completion; +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + URL:(nullable NSString *)url + completion: + (void (^)(NSError *_Nullable))completion; +- (void) + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + navigationAction: + (FWFWKNavigationActionData *)navigationAction + completion: + (void (^)(FWFWKNavigationActionPolicyEnumData + *_Nullable, + NSError *_Nullable))completion; +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FWFNSErrorData *)error + completion:(void (^)(NSError *_Nullable))completion; +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + error:(FWFNSErrorData *)error + completion: + (void (^)(NSError *_Nullable))completion; +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + completion:(void (^)(NSError *_Nullable)) + completion; @end /// The codec used by FWFNSObjectHostApi. NSObject *FWFNSObjectHostApiGetCodec(void); @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath options:(NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier observerIdentifier:(NSNumber *)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier + observerIdentifier:(NSNumber *)observerIdentifier + keyPath:(NSString *)keyPath + options: + (NSArray *)options + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier + observerIdentifier:(NSNumber *)observerIdentifier + keyPath:(NSString *)keyPath + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFNSObjectHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. NSObject *FWFNSObjectFlutterApiGetCodec(void); @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier keyPath:(NSString *)keyPath objectIdentifier:(NSNumber *)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void(^)(NSError *_Nullable))completion; -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier completion:(void(^)(NSError *_Nullable))completion; +- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier + keyPath:(NSString *)keyPath + objectIdentifier:(NSNumber *)objectIdentifier + changeKeys:(NSArray *)changeKeys + changeValues:(NSArray *)changeValues + completion:(void (^)(NSError *_Nullable))completion; +- (void)disposeObjectWithIdentifier:(NSNumber *)identifier + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKWebViewHostApi. NSObject *FWFWKWebViewHostApiGetCodec(void); @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier configurationIdentifier:(NSNumber *)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSNumber *)identifier + configurationIdentifier:(NSNumber *)configurationIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier + delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier + delegateIdentifier: + (nullable NSNumber *)navigationDelegateIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull) + error; +- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier + request:(FWFNSUrlRequestData *)request + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier + HTMLString:(NSString *)string + baseURL:(nullable NSString *)baseUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier + fileURL:(NSString *)url + readAccessURL:(NSString *)readAccessUrl + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier + assetKey:(NSString *)key + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier isAllowed:(NSNumber *)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier javaScriptString:(NSString *)javaScriptString completion:(void(^)(id _Nullable, FlutterError *_Nullable))completion; +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier + error: + (FlutterError *_Nullable *_Nonnull)error; +- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier + isAllowed:(NSNumber *)allow + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setUserAgentForWebViewWithIdentifier:(NSNumber *)identifier + userAgent:(nullable NSString *)userAgent + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier + javaScriptString:(NSString *)javaScriptString + completion:(void (^)(id _Nullable, + FlutterError *_Nullable))completion; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKWebViewHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. NSObject *FWFWKUIDelegateHostApiGetCodec(void); @@ -380,23 +525,33 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); - (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier webViewIdentifier:(NSNumber *)webViewIdentifier configurationIdentifier:(NSNumber *)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void(^)(NSError *_Nullable))completion; +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier + webViewIdentifier:(NSNumber *)webViewIdentifier + configurationIdentifier:(NSNumber *)configurationIdentifier + navigationAction:(FWFWKNavigationActionData *)navigationAction + completion:(void (^)(NSError *_Nullable))completion; @end /// The codec used by FWFWKHttpCookieStoreHostApi. NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void(^)(FlutterError *_Nullable))completion; +- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier + dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier + cookie:(FWFNSHttpCookieData *)cookie + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, + NSObject *_Nullable api); 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 4801175cd328..10680227ee43 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 ?: [NSNull null]), - @"message": (error.message ?: [NSNull null]), - @"details": (error.details ?: [NSNull null]), - }; + @"code" : (error.code ?: [NSNull null]), + @"message" : (error.message ?: [NSNull null]), + @"details" : (error.details ?: [NSNull null]), + }; } return @{ - @"result": (result ?: [NSNull null]), - @"error": errorDict, - }; + @"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; + (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict; @@ -107,16 +106,20 @@ - (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; } -+ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSKeyValueObservingOptionsEnumData fromMap:dict] : nil; } ++ (nullable FWFNSKeyValueObservingOptionsEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSKeyValueObservingOptionsEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -126,7 +129,7 @@ - (NSDictionary *)toMap { @implementation FWFNSKeyValueChangeKeyEnumData + (instancetype)makeWithValue:(FWFNSKeyValueChangeKeyEnum)value { - FWFNSKeyValueChangeKeyEnumData* pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; + FWFNSKeyValueChangeKeyEnumData *pigeonResult = [[FWFNSKeyValueChangeKeyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -135,7 +138,9 @@ + (FWFNSKeyValueChangeKeyEnumData *)fromMap:(NSDictionary *)dict { pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } -+ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSKeyValueChangeKeyEnumData fromMap:dict] : nil; } ++ (nullable FWFNSKeyValueChangeKeyEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSKeyValueChangeKeyEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -145,16 +150,20 @@ - (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; } -+ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKUserScriptInjectionTimeEnumData fromMap:dict] : nil; } ++ (nullable FWFWKUserScriptInjectionTimeEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKUserScriptInjectionTimeEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -164,16 +173,20 @@ - (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; } -+ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKAudiovisualMediaTypeEnumData fromMap:dict] : nil; } ++ (nullable FWFWKAudiovisualMediaTypeEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKAudiovisualMediaTypeEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -183,7 +196,7 @@ - (NSDictionary *)toMap { @implementation FWFWKWebsiteDataTypeEnumData + (instancetype)makeWithValue:(FWFWKWebsiteDataTypeEnum)value { - FWFWKWebsiteDataTypeEnumData* pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; + FWFWKWebsiteDataTypeEnumData *pigeonResult = [[FWFWKWebsiteDataTypeEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } @@ -192,7 +205,9 @@ + (FWFWKWebsiteDataTypeEnumData *)fromMap:(NSDictionary *)dict { pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } -+ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKWebsiteDataTypeEnumData fromMap:dict] : nil; } ++ (nullable FWFWKWebsiteDataTypeEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKWebsiteDataTypeEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -202,16 +217,20 @@ - (NSDictionary *)toMap { @implementation FWFWKNavigationActionPolicyEnumData + (instancetype)makeWithValue:(FWFWKNavigationActionPolicyEnum)value { - FWFWKNavigationActionPolicyEnumData* pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = + [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = value; return pigeonResult; } + (FWFWKNavigationActionPolicyEnumData *)fromMap:(NSDictionary *)dict { - FWFWKNavigationActionPolicyEnumData *pigeonResult = [[FWFWKNavigationActionPolicyEnumData alloc] init]; + FWFWKNavigationActionPolicyEnumData *pigeonResult = + [[FWFWKNavigationActionPolicyEnumData alloc] init]; pigeonResult.value = [GetNullableObject(dict, @"value") integerValue]; return pigeonResult; } -+ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKNavigationActionPolicyEnumData fromMap:dict] : nil; } ++ (nullable FWFWKNavigationActionPolicyEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKNavigationActionPolicyEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -221,16 +240,20 @@ - (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; } -+ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSHttpCookiePropertyKeyEnumData fromMap:dict] : nil; } ++ (nullable FWFNSHttpCookiePropertyKeyEnumData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSHttpCookiePropertyKeyEnumData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"value" : @(self.value), @@ -240,10 +263,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; @@ -260,7 +283,9 @@ + (FWFNSUrlRequestData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } -+ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSUrlRequestData fromMap:dict] : nil; } ++ (nullable FWFNSUrlRequestData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSUrlRequestData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"url" : (self.url ?: [NSNull null]), @@ -273,9 +298,9 @@ - (NSDictionary *)toMap { @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; @@ -285,12 +310,15 @@ + (FWFWKUserScriptData *)fromMap:(NSDictionary *)dict { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObject(dict, @"source"); NSAssert(pigeonResult.source != nil, @""); - pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData nullableFromMap:GetNullableObject(dict, @"injectionTime")]; + pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData + nullableFromMap:GetNullableObject(dict, @"injectionTime")]; pigeonResult.isMainFrameOnly = GetNullableObject(dict, @"isMainFrameOnly"); NSAssert(pigeonResult.isMainFrameOnly != nil, @""); return pigeonResult; } -+ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKUserScriptData fromMap:dict] : nil; } ++ (nullable FWFWKUserScriptData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKUserScriptData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"source" : (self.source ?: [NSNull null]), @@ -302,8 +330,8 @@ - (NSDictionary *)toMap { @implementation FWFWKNavigationActionData + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request - targetFrame:(FWFWKFrameInfoData *)targetFrame { - FWFWKNavigationActionData* pigeonResult = [[FWFWKNavigationActionData alloc] init]; + targetFrame:(FWFWKFrameInfoData *)targetFrame { + FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = request; pigeonResult.targetFrame = targetFrame; return pigeonResult; @@ -312,11 +340,14 @@ + (FWFWKNavigationActionData *)fromMap:(NSDictionary *)dict { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = [FWFNSUrlRequestData nullableFromMap:GetNullableObject(dict, @"request")]; NSAssert(pigeonResult.request != nil, @""); - pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromMap:GetNullableObject(dict, @"targetFrame")]; + pigeonResult.targetFrame = + [FWFWKFrameInfoData nullableFromMap:GetNullableObject(dict, @"targetFrame")]; NSAssert(pigeonResult.targetFrame != nil, @""); return pigeonResult; } -+ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKNavigationActionData fromMap:dict] : nil; } ++ (nullable FWFWKNavigationActionData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKNavigationActionData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"request" : (self.request ? [self.request toMap] : [NSNull null]), @@ -327,7 +358,7 @@ - (NSDictionary *)toMap { @implementation FWFWKFrameInfoData + (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { - FWFWKFrameInfoData* pigeonResult = [[FWFWKFrameInfoData alloc] init]; + FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } @@ -337,7 +368,9 @@ + (FWFWKFrameInfoData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.isMainFrame != nil, @""); return pigeonResult; } -+ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKFrameInfoData fromMap:dict] : nil; } ++ (nullable FWFWKFrameInfoData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKFrameInfoData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"isMainFrame" : (self.isMainFrame ?: [NSNull null]), @@ -347,9 +380,9 @@ - (NSDictionary *)toMap { @implementation FWFNSErrorData + (instancetype)makeWithCode:(NSNumber *)code - domain:(NSString *)domain - localizedDescription:(NSString *)localizedDescription { - FWFNSErrorData* pigeonResult = [[FWFNSErrorData alloc] init]; + domain:(NSString *)domain + localizedDescription:(NSString *)localizedDescription { + FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; pigeonResult.code = code; pigeonResult.domain = domain; pigeonResult.localizedDescription = localizedDescription; @@ -365,7 +398,9 @@ + (FWFNSErrorData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.localizedDescription != nil, @""); return pigeonResult; } -+ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSErrorData fromMap:dict] : nil; } ++ (nullable FWFNSErrorData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSErrorData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"code" : (self.code ?: [NSNull null]), @@ -376,9 +411,8 @@ - (NSDictionary *)toMap { @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name - body:(id )body { - FWFWKScriptMessageData* pigeonResult = [[FWFWKScriptMessageData alloc] init]; ++ (instancetype)makeWithName:(NSString *)name body:(id)body { + FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; return pigeonResult; @@ -390,7 +424,9 @@ + (FWFWKScriptMessageData *)fromMap:(NSDictionary *)dict { pigeonResult.body = GetNullableObject(dict, @"body"); return pigeonResult; } -+ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFWKScriptMessageData fromMap:dict] : nil; } ++ (nullable FWFWKScriptMessageData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFWKScriptMessageData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"name" : (self.name ?: [NSNull null]), @@ -401,8 +437,8 @@ - (NSDictionary *)toMap { @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; @@ -415,7 +451,9 @@ + (FWFNSHttpCookieData *)fromMap:(NSDictionary *)dict { NSAssert(pigeonResult.propertyValues != nil, @""); return pigeonResult; } -+ (nullable FWFNSHttpCookieData *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [FWFNSHttpCookieData fromMap:dict] : nil; } ++ (nullable FWFNSHttpCookieData *)nullableFromMap:(NSDictionary *)dict { + return (dict) ? [FWFNSHttpCookieData fromMap:dict] : nil; +} - (NSDictionary *)toMap { return @{ @"propertyKeys" : (self.propertyKeys ?: [NSNull null]), @@ -427,15 +465,13 @@ - (NSDictionary *)toMap { @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 @@ -443,13 +479,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]; } } @@ -470,43 +504,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(createDefaultDataStoreWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createDefaultDataStoreWithIdentifier:error:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(createDefaultDataStoreWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -514,30 +557,36 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes" binaryMessenger:binaryMessenger - codec:FWFWKWebsiteDataStoreHostApiGetCodec() ]; + codec:FWFWKWebsiteDataStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to @selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)], + @"FWFWKWebsiteDataStoreHostApi api (%@) doesn't respond to " + @"@selector(removeDataFromDataStoreWithIdentifier:ofTypes:modifiedSince:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); - [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api removeDataFromDataStoreWithIdentifier:arg_identifier + ofTypes:arg_dataTypes + modifiedSince:arg_modificationTimeInSecondsSinceEpoch + completion:^(NSNumber *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -567,22 +616,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -591,19 +644,20 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIViewHostApi.setOpaque" binaryMessenger:binaryMessenger - codec:FWFUIViewHostApiGetCodec() ]; + codec:FWFUIViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], @"FWFUIViewHostApi api (%@) doesn't respond to @selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", api); + NSCAssert([api respondsToSelector:@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)], + @"FWFUIViewHostApi api (%@) doesn't respond to " + @"@selector(setOpaqueForViewWithIdentifier:isOpaque:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -612,8 +666,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, NSObject< [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -643,63 +696,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier + webViewIdentifier:arg_webViewIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(contentOffsetForScrollViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(contentOffsetForScrollViewWithIdentifier:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(contentOffsetForScrollViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; + NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.scrollBy" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(scrollByForScrollViewWithIdentifier:x:y:error:)", api); + NSCAssert([api respondsToSelector:@selector(scrollByForScrollViewWithIdentifier:x:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(scrollByForScrollViewWithIdentifier:x:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -709,30 +771,34 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, NSO [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset" binaryMessenger:binaryMessenger - codec:FWFUIScrollViewHostApiGetCodec() ]; + codec:FWFUIScrollViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], @"FWFUIScrollViewHostApi api (%@) doesn't respond to @selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setContentOffsetForScrollViewWithIdentifier:toX:y:error:)], + @"FWFUIScrollViewHostApi api (%@) doesn't respond to " + @"@selector(setContentOffsetForScrollViewWithIdentifier:toX:y:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x y:arg_y error:&error]; + [api setContentOffsetForScrollViewWithIdentifier:arg_identifier + toX:arg_x + y:arg_y + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -740,15 +806,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 @@ -756,13 +820,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]; } } @@ -783,22 +845,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -806,71 +871,87 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(createFromWebViewWithIdentifier: + webViewIdentifier:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(createFromWebViewWithIdentifier:webViewIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier error:&error]; + [api createFromWebViewWithIdentifier:arg_identifier + webViewIdentifier:arg_webViewIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", api); + NSCAssert( + [api respondsToSelector:@selector + (setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; + [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewConfigurationHostApi." + @"setMediaTypesRequiringUserActionForPlayback" binaryMessenger:binaryMessenger - codec:FWFWKWebViewConfigurationHostApiGetCodec() ]; + codec:FWFWKWebViewConfigurationHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)], @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to @selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setMediaTypesRequiresUserActionForConfigurationWithIdentifier: + forTypes:error:)], + @"FWFWKWebViewConfigurationHostApi api (%@) doesn't respond to " + @"@selector(setMediaTypesRequiresUserActionForConfigurationWithIdentifier:forTypes:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier forTypes:arg_types error:&error]; + [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier + forTypes:arg_types + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -900,15 +981,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKWebViewConfigurationFlutterApiCodecReaderWriter *readerWriter = [[FWFWKWebViewConfigurationFlutterApiCodecReaderWriter alloc] init]; + FWFWKWebViewConfigurationFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKWebViewConfigurationFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKWebViewConfigurationFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKWebViewConfigurationFlutterApi @@ -920,32 +1001,31 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)createWithIdentifier:(NSNumber *)arg_identifier + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create" - binaryMessenger:self.binaryMessenger - codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKUserContentControllerHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKUserContentControllerHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -953,17 +1033,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]; } } @@ -984,86 +1061,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:ofName:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addScriptMessageHandlerForControllerWithIdentifier: + handlerIdentifier:ofName:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addScriptMessageHandlerForControllerWithIdentifier:handlerIdentifier:" + @"ofName:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier handlerIdentifier:arg_handlerIdentifier ofName:arg_name error:&error]; + [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier + handlerIdentifier:arg_handlerIdentifier + ofName:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeScriptMessageHandlerForControllerWithIdentifier:name:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeScriptMessageHandlerForControllerWithIdentifier:name:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier name:arg_name error:&error]; + [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier + name:arg_name + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllScriptMessageHandlersForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllScriptMessageHandlersForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1071,40 +1171,46 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier:userScript:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(addUserScriptForControllerWithIdentifier:userScript:error:)", api); + NSCAssert([api respondsToSelector:@selector(addUserScriptForControllerWithIdentifier: + userScript:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(addUserScriptForControllerWithIdentifier:userScript:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api addUserScriptForControllerWithIdentifier:arg_identifier userScript:arg_userScript error:&error]; + [api addUserScriptForControllerWithIdentifier:arg_identifier + userScript:arg_userScript + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts" binaryMessenger:binaryMessenger - codec:FWFWKUserContentControllerHostApiGetCodec() ]; + codec:FWFWKUserContentControllerHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeAllUserScriptsForControllerWithIdentifier:error:)], @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to @selector(removeAllUserScriptsForControllerWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector + (removeAllUserScriptsForControllerWithIdentifier:error:)], + @"FWFWKUserContentControllerHostApi api (%@) doesn't respond to " + @"@selector(removeAllUserScriptsForControllerWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -1112,8 +1218,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1143,53 +1248,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createFromWebViewConfigurationWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled" binaryMessenger:binaryMessenger - codec:FWFWKPreferencesHostApiGetCodec() ]; + codec:FWFWKPreferencesHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], @"FWFWKPreferencesHostApi api (%@) doesn't respond to @selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)], + @"FWFWKPreferencesHostApi api (%@) doesn't respond to " + @"@selector(setJavaScriptEnabledForPreferencesWithIdentifier:isEnabled:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled error:&error]; + [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier + isEnabled:arg_enabled + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1219,22 +1334,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1242,8 +1360,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1251,15 +1368,13 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess @interface FWFWKScriptMessageHandlerFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1267,13 +1382,11 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKScriptMessageHandlerFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKScriptMessageHandlerFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1294,15 +1407,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; + FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKScriptMessageHandlerFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKScriptMessageHandlerFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKScriptMessageHandlerFlutterApi @@ -1314,15 +1427,23 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" - binaryMessenger:self.binaryMessenger - codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], arg_message ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier + userContentControllerIdentifier: + (NSNumber *)arg_userContentControllerIdentifier + message:(FWFWKScriptMessageData *)arg_message + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" + binaryMessenger:self.binaryMessenger + codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], + arg_message ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKNavigationDelegateHostApiCodecReader : FlutterStandardReader @@ -1350,22 +1471,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1373,8 +1497,7 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1382,27 +1505,25 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen @interface FWFWKNavigationDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKNavigationDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1410,29 +1531,23 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKNavigationDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKNavigationDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1453,15 +1568,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 @@ -1473,80 +1588,124 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_url ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(FWFWKNavigationActionPolicyEnumData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); - }]; -} -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + URL:(nullable NSString *)arg_url + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_url ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + URL:(nullable NSString *)arg_url + completion: + (void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_url ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void) + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + navigationAction: + (FWFWKNavigationActionData *)arg_navigationAction + completion: + (void (^)(FWFWKNavigationActionPolicyEnumData + *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_navigationAction ?: [NSNull null] + ] + reply:^(id reply) { + FWFWKNavigationActionPolicyEnumData *output = reply; + completion(output, nil); + }]; +} +- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + error:(FWFNSErrorData *)arg_error + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_error ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" - binaryMessenger:self.binaryMessenger - codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_error ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + error:(FWFNSErrorData *)arg_error + completion: + (void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_error ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier: + (NSNumber *)arg_webViewIdentifier + completion:(void (^)(NSError *_Nullable)) + completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" + binaryMessenger:self.binaryMessenger + codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFNSObjectHostApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1554,13 +1713,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]; } } @@ -1581,22 +1738,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -1604,53 +1764,67 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.addObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:error:)", api); + NSCAssert([api respondsToSelector:@selector + (addObserverForObjectWithIdentifier: + observerIdentifier:keyPath:options:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(addObserverForObjectWithIdentifier:observerIdentifier:keyPath:options:" + @"error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); - NSArray *arg_options = GetNullableObjectAtIndex(args, 3); + NSArray *arg_options = + GetNullableObjectAtIndex(args, 3); FlutterError *error; - [api addObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath options:arg_options error:&error]; + [api addObserverForObjectWithIdentifier:arg_identifier + observerIdentifier:arg_observerIdentifier + keyPath:arg_keyPath + options:arg_options + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.NSObjectHostApi.removeObserver" binaryMessenger:binaryMessenger - codec:FWFNSObjectHostApiGetCodec() ]; + codec:FWFNSObjectHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)], @"FWFNSObjectHostApi api (%@) doesn't respond to @selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(removeObserverForObjectWithIdentifier: + observerIdentifier:keyPath:error:)], + @"FWFNSObjectHostApi api (%@) doesn't respond to " + @"@selector(removeObserverForObjectWithIdentifier:observerIdentifier:keyPath:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api removeObserverForObjectWithIdentifier:arg_identifier observerIdentifier:arg_observerIdentifier keyPath:arg_keyPath error:&error]; + [api removeObserverForObjectWithIdentifier:arg_identifier + observerIdentifier:arg_observerIdentifier + keyPath:arg_keyPath + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -1658,54 +1832,52 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, NSObjec @interface FWFNSObjectFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFNSObjectFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 136: + + case 136: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 137: + + case 137: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - case 138: + + case 138: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - case 139: + + case 139: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 140: + + case 140: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 141: + + case 141: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1713,65 +1885,50 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFNSObjectFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFNSObjectFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1792,15 +1949,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; + FWFNSObjectFlutterApiCodecReaderWriter *readerWriter = + [[FWFNSObjectFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFNSObjectFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFNSObjectFlutterApi @@ -1812,78 +1969,87 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier keyPath:(NSString *)arg_keyPath objectIdentifier:(NSNumber *)arg_objectIdentifier changeKeys:(NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier + keyPath:(NSString *)arg_keyPath + objectIdentifier:(NSNumber *)arg_objectIdentifier + changeKeys: + (NSArray *)arg_changeKeys + changeValues:(NSArray *)arg_changeValues + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.observeValue" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; -} -- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], + arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], + arg_changeValues ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; +} +- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.dispose" - binaryMessenger:self.binaryMessenger - codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFNSObjectFlutterApiGetCodec()]; + [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKWebViewHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKWebViewHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSErrorData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - case 131: + + case 131: return [FWFNSKeyValueChangeKeyEnumData fromMap:[self readValue]]; - - case 132: + + case 132: return [FWFNSKeyValueObservingOptionsEnumData fromMap:[self readValue]]; - - case 133: + + case 133: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 134: + + case 134: return [FWFWKAudiovisualMediaTypeEnumData fromMap:[self readValue]]; - - case 135: + + case 135: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 136: + + case 136: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - case 137: + + case 137: return [FWFWKNavigationActionPolicyEnumData fromMap:[self readValue]]; - - case 138: + + case 138: return [FWFWKScriptMessageData fromMap:[self readValue]]; - - case 139: + + case 139: return [FWFWKUserScriptData fromMap:[self readValue]]; - - case 140: + + case 140: return [FWFWKUserScriptInjectionTimeEnumData fromMap:[self readValue]]; - - case 141: + + case 141: return [FWFWKWebsiteDataTypeEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -1891,65 +2057,50 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKWebViewHostApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKWebViewHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSErrorData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { + } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { + } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:136]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) { [self writeByte:137]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { + } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) { [self writeByte:138]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) { [self writeByte:139]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) { [self writeByte:140]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { + } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) { [self writeByte:141]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -1970,85 +2121,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier error:&error]; + [api createWithIdentifier:arg_identifier + configurationIdentifier:arg_configurationIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUIDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUIDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUIDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_uiDelegateIdentifier error:&error]; + [api setUIDelegateForWebViewWithIdentifier:arg_identifier + delegateIdentifier:arg_uiDelegateIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(setNavigationDelegateForWebViewWithIdentifier: + delegateIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setNavigationDelegateForWebViewWithIdentifier:delegateIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier delegateIdentifier:arg_navigationDelegateIdentifier error:&error]; + [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier + delegateIdentifier:arg_navigationDelegateIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(URLForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(URLForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(URLForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2056,39 +2223,44 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(estimatedProgressForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(estimatedProgressForWebViewWithIdentifier: + error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(estimatedProgressForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FlutterError *error; - NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; + NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadRequest" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier:request:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadRequestForWebViewWithIdentifier:request:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadRequestForWebViewWithIdentifier: + request:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadRequestForWebViewWithIdentifier:request:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2097,63 +2269,75 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadHTMLForWebViewWithIdentifier: + HTMLString:baseURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadHTMLForWebViewWithIdentifier:HTMLString:baseURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadHTMLForWebViewWithIdentifier:arg_identifier HTMLString:arg_string baseURL:arg_baseUrl error:&error]; + [api loadHTMLForWebViewWithIdentifier:arg_identifier + HTMLString:arg_string + baseURL:arg_baseUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", api); + NSCAssert([api respondsToSelector:@selector + (loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadFileForWebViewWithIdentifier:fileURL:readAccessURL:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; - [api loadFileForWebViewWithIdentifier:arg_identifier fileURL:arg_url readAccessURL:arg_readAccessUrl error:&error]; + [api loadFileForWebViewWithIdentifier:arg_identifier + fileURL:arg_url + readAccessURL:arg_readAccessUrl + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", api); + NSCAssert([api respondsToSelector:@selector(loadAssetForWebViewWithIdentifier: + assetKey:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(loadAssetForWebViewWithIdentifier:assetKey:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2162,19 +2346,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2182,19 +2367,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.canGoForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(canGoForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(canGoForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(canGoForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2202,19 +2388,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goBack" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goBackForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goBackForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goBackForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2222,19 +2409,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.goForward" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(goForwardForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(goForwardForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(goForwardForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2242,19 +2430,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.reload" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(reloadWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(reloadWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(reloadWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2262,19 +2451,20 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.getTitle" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(titleForWebViewWithIdentifier:error:)", api); + NSCAssert([api respondsToSelector:@selector(titleForWebViewWithIdentifier:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(titleForWebViewWithIdentifier:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); @@ -2282,71 +2472,85 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, NSObje NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + @"dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", api); + NSCAssert([api respondsToSelector:@selector + (setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setAllowsBackForwardForWebViewWithIdentifier:isAllowed:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow error:&error]; + [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier + isAllowed:arg_allow + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", api); + NSCAssert([api respondsToSelector:@selector(setUserAgentForWebViewWithIdentifier: + userAgent:error:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(setUserAgentForWebViewWithIdentifier:userAgent:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api setUserAgentForWebViewWithIdentifier:arg_identifier userAgent:arg_userAgent error:&error]; + [api setUserAgentForWebViewWithIdentifier:arg_identifier + userAgent:arg_userAgent + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript" binaryMessenger:binaryMessenger - codec:FWFWKWebViewHostApiGetCodec() ]; + codec:FWFWKWebViewHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], @"FWFWKWebViewHostApi api (%@) doesn't respond to @selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector + (evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)], + @"FWFWKWebViewHostApi api (%@) doesn't respond to " + @"@selector(evaluateJavaScriptForWebViewWithIdentifier:javaScriptString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); - [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier + javaScriptString:arg_javaScriptString + completion:^(id _Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -2376,22 +2580,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_identifier = GetNullableObjectAtIndex(args, 0); @@ -2399,8 +2606,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -2408,21 +2614,19 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, NSO @interface FWFWKUIDelegateFlutterApiCodecReader : FlutterStandardReader @end @implementation FWFWKUIDelegateFlutterApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSUrlRequestData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFWKFrameInfoData fromMap:[self readValue]]; - - case 130: + + case 130: return [FWFWKNavigationActionData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -2430,21 +2634,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface FWFWKUIDelegateFlutterApiCodecWriter : FlutterStandardWriter @end @implementation FWFWKUIDelegateFlutterApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[FWFNSUrlRequestData class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { + } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { + } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; - } else -{ + } else { [super writeValue:value]; } } @@ -2465,15 +2665,15 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ - FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; + FWFWKUIDelegateFlutterApiCodecReaderWriter *readerWriter = + [[FWFWKUIDelegateFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - @interface FWFWKUIDelegateFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FWFWKUIDelegateFlutterApi @@ -2485,32 +2685,37 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier webViewIdentifier:(NSNumber *)arg_webViewIdentifier configurationIdentifier:(NSNumber *)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier + webViewIdentifier:(NSNumber *)arg_webViewIdentifier + configurationIdentifier:(NSNumber *)arg_configurationIdentifier + navigationAction:(FWFWKNavigationActionData *)arg_navigationAction + completion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView" - binaryMessenger:self.binaryMessenger - codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null]] reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FWFWKUIDelegateFlutterApiGetCodec()]; + [channel sendMessage:@[ + arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], + arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] + ] + reply:^(id reply) { + completion(nil); + }]; } @end @interface FWFWKHttpCookieStoreHostApiCodecReader : FlutterStandardReader @end @implementation FWFWKHttpCookieStoreHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FWFNSHttpCookieData fromMap:[self readValue]]; - - case 129: + + case 129: return [FWFNSHttpCookiePropertyKeyEnumData fromMap:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -2518,17 +2723,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]; } } @@ -2549,53 +2751,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_identifier = GetNullableObjectAtIndex(args, 0); NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; - [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier error:&error]; + [api createFromWebsiteDataStoreWithIdentifier:arg_identifier + dataStoreIdentifier:arg_websiteDataStoreIdentifier + error:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie" binaryMessenger:binaryMessenger - codec:FWFWKHttpCookieStoreHostApiGetCodec() ]; + codec:FWFWKHttpCookieStoreHostApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier:cookie:completion:)], @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to @selector(setCookieForStoreWithIdentifier:cookie:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setCookieForStoreWithIdentifier: + cookie:completion:)], + @"FWFWKHttpCookieStoreHostApi api (%@) doesn't respond to " + @"@selector(setCookieForStoreWithIdentifier:cookie:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); - [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setCookieForStoreWithIdentifier:arg_identifier + cookie:arg_cookie + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index a0332b10d102..b935087b1874 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -37,12 +37,16 @@ - (void)onCreateWebViewForDelegate:(FWFUIDelegate *)instance @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNavigationAction(navigationAction); - + if (![self.instanceManager containsInstance:configuration]) { - FWFWebViewConfigurationFlutterApiImpl *flutterApi = [[FWFWebViewConfigurationFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [flutterApi createWithConfiguration:configuration completion:^(NSError *error) { - NSAssert(!error, @"%@", error); - }]; + FWFWebViewConfigurationFlutterApiImpl *flutterApi = + [[FWFWebViewConfigurationFlutterApiImpl alloc] + initWithBinaryMessenger:self.binaryMessenger + instanceManager:self.instanceManager]; + [flutterApi createWithConfiguration:configuration + completion:^(NSError *error) { + NSAssert(!error, @"%@", error); + }]; } [self onCreateWebViewForDelegateWithIdentifier:@([self identifierForDelegate:instance]) webViewIdentifier: diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h index 56e9c5ac625d..014e022e0281 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; - (void)createWithConfiguration:(WKWebViewConfiguration *)configuration - completion:(void (^)(NSError * _Nullable))completion; + completion:(void (^)(NSError *_Nullable))completion; @end @interface FWFWebViewConfiguration : WKWebViewConfiguration 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 e9600d45cc47..5513b8b9145d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -23,7 +23,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen } - (void)createWithConfiguration:(WKWebViewConfiguration *)configuration - completion:(void (^)(NSError * _Nullable))completion { + completion:(void (^)(NSError *_Nullable))completion { long identifier = [self.instanceManager addHostCreatedInstance:configuration]; [self createWithIdentifier:@(identifier) completion:completion]; } 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 3f7618493f67..54bb3015af64 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 @@ -94,8 +94,7 @@ class NSKeyValueObservingOptionsEnumData { static NSKeyValueObservingOptionsEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSKeyValueObservingOptionsEnumData( - value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int] -, + value: NSKeyValueObservingOptionsEnum.values[pigeonMap['value']! as int], ); } } @@ -116,8 +115,7 @@ class NSKeyValueChangeKeyEnumData { static NSKeyValueChangeKeyEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSKeyValueChangeKeyEnumData( - value: NSKeyValueChangeKeyEnum.values[pigeonMap['value']! as int] -, + value: NSKeyValueChangeKeyEnum.values[pigeonMap['value']! as int], ); } } @@ -138,8 +136,7 @@ class WKUserScriptInjectionTimeEnumData { static WKUserScriptInjectionTimeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKUserScriptInjectionTimeEnumData( - value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int] -, + value: WKUserScriptInjectionTimeEnum.values[pigeonMap['value']! as int], ); } } @@ -160,8 +157,7 @@ class WKAudiovisualMediaTypeEnumData { static WKAudiovisualMediaTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKAudiovisualMediaTypeEnumData( - value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int] -, + value: WKAudiovisualMediaTypeEnum.values[pigeonMap['value']! as int], ); } } @@ -182,8 +178,7 @@ class WKWebsiteDataTypeEnumData { static WKWebsiteDataTypeEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKWebsiteDataTypeEnumData( - value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int] -, + value: WKWebsiteDataTypeEnum.values[pigeonMap['value']! as int], ); } } @@ -204,8 +199,7 @@ class WKNavigationActionPolicyEnumData { static WKNavigationActionPolicyEnumData decode(Object message) { final Map pigeonMap = message as Map; return WKNavigationActionPolicyEnumData( - value: WKNavigationActionPolicyEnum.values[pigeonMap['value']! as int] -, + value: WKNavigationActionPolicyEnum.values[pigeonMap['value']! as int], ); } } @@ -226,8 +220,7 @@ class NSHttpCookiePropertyKeyEnumData { static NSHttpCookiePropertyKeyEnumData decode(Object message) { final Map pigeonMap = message as Map; return NSHttpCookiePropertyKeyEnumData( - value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int] -, + value: NSHttpCookiePropertyKeyEnum.values[pigeonMap['value']! as int], ); } } @@ -260,7 +253,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(), ); } } @@ -289,7 +284,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, ); @@ -315,10 +311,8 @@ class WKNavigationActionData { static WKNavigationActionData decode(Object message) { final Map pigeonMap = message as Map; return WKNavigationActionData( - request: NSUrlRequestData.decode(pigeonMap['request']!) -, - targetFrame: WKFrameInfoData.decode(pigeonMap['targetFrame']!) -, + request: NSUrlRequestData.decode(pigeonMap['request']!), + targetFrame: WKFrameInfoData.decode(pigeonMap['targetFrame']!), ); } } @@ -417,8 +411,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(), ); } } @@ -430,20 +426,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); - } } } @@ -452,24 +447,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_configurationIdentifier]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_configurationIdentifier]) + 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?, @@ -482,7 +483,9 @@ class WKWebsiteDataStoreHostApi { Future createDefaultDataStore(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -491,7 +494,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?, @@ -502,18 +506,26 @@ class WKWebsiteDataStoreHostApi { } } - Future removeDataOfTypes(int arg_identifier, List arg_dataTypes, double arg_modificationTimeInSecondsSinceEpoch) async { + Future removeDataOfTypes( + int arg_identifier, + List arg_dataTypes, + double arg_modificationTimeInSecondsSinceEpoch) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_dataTypes, arg_modificationTimeInSecondsSinceEpoch]) as Map?; + 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_identifier, + arg_dataTypes, + arg_modificationTimeInSecondsSinceEpoch + ]) 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?, @@ -538,7 +550,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; @@ -546,16 +559,18 @@ class UIViewHostApi { Future setBackgroundColor(int arg_identifier, int? arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_value]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -568,16 +583,18 @@ class UIViewHostApi { Future setOpaque(int arg_identifier, bool arg_opaque) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_opaque]) as Map?; + 'dev.flutter.pigeon.UIViewHostApi.setOpaque', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -597,24 +614,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_identifier, int arg_webViewIdentifier) async { + Future createFromWebView( + int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_webViewIdentifier]) as Map?; + await channel.send([arg_identifier, arg_webViewIdentifier]) + 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,7 +649,8 @@ class UIScrollViewHostApi { Future> getContentOffset(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -636,7 +659,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?, @@ -654,16 +678,19 @@ class UIScrollViewHostApi { Future scrollBy(int arg_identifier, 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_identifier, arg_x, arg_y]) as Map?; + await channel.send([arg_identifier, 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?, @@ -674,18 +701,22 @@ class UIScrollViewHostApi { } } - Future setContentOffset(int arg_identifier, double arg_x, double arg_y) async { + Future setContentOffset( + int arg_identifier, double arg_x, double arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_x, arg_y]) as Map?; + await channel.send([arg_identifier, 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?, @@ -704,20 +735,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); - } } } @@ -726,15 +756,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -743,7 +776,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?, @@ -754,18 +788,23 @@ class WKWebViewConfigurationHostApi { } } - Future createFromWebView(int arg_identifier, int arg_webViewIdentifier) async { + Future createFromWebView( + int arg_identifier, int arg_webViewIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_webViewIdentifier]) as Map?; + await channel.send([arg_identifier, arg_webViewIdentifier]) + 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?, @@ -776,18 +815,22 @@ class WKWebViewConfigurationHostApi { } } - Future setAllowsInlineMediaPlayback(int arg_identifier, bool arg_allow) async { + Future setAllowsInlineMediaPlayback( + int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -798,18 +841,22 @@ class WKWebViewConfigurationHostApi { } } - Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, List arg_types) async { + Future setMediaTypesRequiringUserActionForPlayback(int arg_identifier, + List arg_types) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_types]) as Map?; + 'dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -824,22 +871,28 @@ class WKWebViewConfigurationHostApi { class _WKWebViewConfigurationFlutterApiCodec extends StandardMessageCodec { const _WKWebViewConfigurationFlutterApiCodec(); } + abstract class WKWebViewConfigurationFlutterApi { - static const MessageCodec codec = _WKWebViewConfigurationFlutterApiCodec(); + static const MessageCodec codec = + _WKWebViewConfigurationFlutterApiCodec(); void create(int identifier); - static void setup(WKWebViewConfigurationFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WKWebViewConfigurationFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); api.create(arg_identifier!); return; }); @@ -855,27 +908,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); - } } } @@ -884,24 +935,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_configurationIdentifier]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_configurationIdentifier]) + 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?, @@ -912,18 +970,23 @@ class WKUserContentControllerHostApi { } } - Future addScriptMessageHandler(int arg_identifier, int arg_handlerIdentifier, String arg_name) async { + Future addScriptMessageHandler( + int arg_identifier, int arg_handlerIdentifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_handlerIdentifier, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_handlerIdentifier, 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?, @@ -934,18 +997,22 @@ class WKUserContentControllerHostApi { } } - Future removeScriptMessageHandler(int arg_identifier, String arg_name) async { + Future removeScriptMessageHandler( + int arg_identifier, String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_name]) as Map?; + 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -958,7 +1025,9 @@ class WKUserContentControllerHostApi { Future removeAllScriptMessageHandlers(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -967,7 +1036,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?, @@ -978,18 +1048,23 @@ class WKUserContentControllerHostApi { } } - Future addUserScript(int arg_identifier, WKUserScriptData arg_userScript) async { + Future addUserScript( + int arg_identifier, WKUserScriptData arg_userScript) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript', + codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_userScript]) as Map?; + await channel.send([arg_identifier, 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?, @@ -1002,7 +1077,9 @@ class WKUserContentControllerHostApi { Future removeAllUserScripts(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1011,7 +1088,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?, @@ -1031,24 +1109,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_identifier, int arg_configurationIdentifier) async { + Future createFromWebViewConfiguration( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_configurationIdentifier]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_configurationIdentifier]) + 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?, @@ -1059,18 +1143,21 @@ class WKPreferencesHostApi { } } - Future setJavaScriptEnabled(int arg_identifier, bool arg_enabled) async { + Future setJavaScriptEnabled( + int arg_identifier, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_enabled]) as Map?; + 'dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -1090,15 +1177,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1107,7 +1197,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?, @@ -1126,44 +1217,55 @@ class _WKScriptMessageHandlerFlutterApiCodec extends StandardMessageCodec { if (value is WKScriptMessageData) { 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 WKScriptMessageData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class WKScriptMessageHandlerFlutterApi { - static const MessageCodec codec = _WKScriptMessageHandlerFlutterApiCodec(); + static const MessageCodec codec = + _WKScriptMessageHandlerFlutterApiCodec(); - void didReceiveScriptMessage(int identifier, int userContentControllerIdentifier, WKScriptMessageData message); - static void setup(WKScriptMessageHandlerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void didReceiveScriptMessage(int identifier, + int userContentControllerIdentifier, WKScriptMessageData message); + static void setup(WKScriptMessageHandlerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); final int? arg_userContentControllerIdentifier = (args[1] as int?); - assert(arg_userContentControllerIdentifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); - final WKScriptMessageData? arg_message = (args[2] as WKScriptMessageData?); - assert(arg_message != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, arg_userContentControllerIdentifier!, arg_message!); + assert(arg_userContentControllerIdentifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null int.'); + final WKScriptMessageData? arg_message = + (args[2] as WKScriptMessageData?); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); + api.didReceiveScriptMessage(arg_identifier!, + arg_userContentControllerIdentifier!, arg_message!); return; }); } @@ -1179,15 +1281,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_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1196,7 +1301,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?, @@ -1215,173 +1321,219 @@ class _WKNavigationDelegateFlutterApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is WKFrameInfoData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSUrlRequestData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKFrameInfoData.decode(readValue(buffer)!); - - case 131: + + case 131: return WKNavigationActionData.decode(readValue(buffer)!); - - case 132: + + case 132: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class WKNavigationDelegateFlutterApi { - static const MessageCodec codec = _WKNavigationDelegateFlutterApiCodec(); + static const MessageCodec codec = + _WKNavigationDelegateFlutterApiCodec(); void didFinishNavigation(int identifier, int webViewIdentifier, String? url); - void didStartProvisionalNavigation(int identifier, int webViewIdentifier, String? url); - Future decidePolicyForNavigationAction(int identifier, int webViewIdentifier, WKNavigationActionData navigationAction); - void didFailNavigation(int identifier, int webViewIdentifier, NSErrorData error); - void didFailProvisionalNavigation(int identifier, int webViewIdentifier, NSErrorData error); - void webViewWebContentProcessDidTerminate(int identifier, int webViewIdentifier); - static void setup(WKNavigationDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void didStartProvisionalNavigation( + int identifier, int webViewIdentifier, String? url); + Future decidePolicyForNavigationAction( + int identifier, + int webViewIdentifier, + WKNavigationActionData navigationAction); + void didFailNavigation( + int identifier, int webViewIdentifier, NSErrorData error); + void didFailProvisionalNavigation( + int identifier, int webViewIdentifier, NSErrorData error); + void webViewWebContentProcessDidTerminate( + int identifier, int webViewIdentifier); + static void setup(WKNavigationDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didFinishNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_url); + api.didStartProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = (args[2] as WKNavigationActionData?); - assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = await api.decidePolicyForNavigationAction(arg_identifier!, arg_webViewIdentifier!, arg_navigationAction!); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = + (args[2] as WKNavigationActionData?); + assert(arg_navigationAction != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); + final WKNavigationActionPolicyEnumData output = + await api.decidePolicyForNavigationAction(arg_identifier!, + arg_webViewIdentifier!, arg_navigationAction!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); + api.didFailNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null int.'); final NSErrorData? arg_error = (args[2] as NSErrorData?); - assert(arg_error != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation(arg_identifier!, arg_webViewIdentifier!, arg_error!); + assert(arg_error != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); + api.didFailProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate', + codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate(arg_identifier!, arg_webViewIdentifier!); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); + api.webViewWebContentProcessDidTerminate( + arg_identifier!, arg_webViewIdentifier!); return; }); } @@ -1396,20 +1548,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); - } } } @@ -1418,7 +1569,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; @@ -1426,7 +1578,8 @@ class NSObjectHostApi { Future dispose(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1435,7 +1588,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?, @@ -1446,18 +1600,28 @@ class NSObjectHostApi { } } - Future addObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath, List arg_options) async { + Future addObserver( + int arg_identifier, + int arg_observerIdentifier, + String arg_keyPath, + List arg_options) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath, arg_options]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.addObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send([ + arg_identifier, + arg_observerIdentifier, + 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?, @@ -1468,18 +1632,22 @@ class NSObjectHostApi { } } - Future removeObserver(int arg_identifier, int arg_observerIdentifier, String arg_keyPath) async { + Future removeObserver(int arg_identifier, int arg_observerIdentifier, + String arg_keyPath) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_observerIdentifier, arg_keyPath]) as Map?; + 'dev.flutter.pigeon.NSObjectHostApi.removeObserver', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel.send( + [arg_identifier, arg_observerIdentifier, 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?, @@ -1498,155 +1666,161 @@ class _NSObjectFlutterApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookieData) { + } else if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueChangeKeyEnumData) { + } else if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKFrameInfoData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else - if (value is WKScriptMessageData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class NSObjectFlutterApi { static const MessageCodec codec = _NSObjectFlutterApiCodec(); - void observeValue(int identifier, String keyPath, int objectIdentifier, List changeKeys, List changeValues); + void observeValue( + int identifier, + String keyPath, + int objectIdentifier, + List changeKeys, + List changeValues); void dispose(int identifier); - static void setup(NSObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NSObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectFlutterApi.observeValue', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); final String? arg_keyPath = (args[1] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null String.'); final int? arg_objectIdentifier = (args[2] as int?); - assert(arg_objectIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); - final List? arg_changeKeys = (args[3] as List?)?.cast(); - assert(arg_changeKeys != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - final List? arg_changeValues = (args[4] as List?)?.cast(); - assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); + assert(arg_objectIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null int.'); + final List? arg_changeKeys = + (args[3] as List?)?.cast(); + assert(arg_changeKeys != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + final List? arg_changeValues = + (args[4] as List?)?.cast(); + assert(arg_changeValues != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List.'); + api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, + arg_changeKeys!, arg_changeValues!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectFlutterApi.dispose', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.NSObjectFlutterApi.dispose', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return; }); @@ -1662,111 +1836,97 @@ class _WKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookieData) { + } else if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueChangeKeyEnumData) { + } else if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKFrameInfoData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else - if (value is WKScriptMessageData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } @@ -1775,24 +1935,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_identifier, int arg_configurationIdentifier) async { + Future create( + int arg_identifier, int arg_configurationIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_configurationIdentifier]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_configurationIdentifier]) + 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?, @@ -1803,18 +1968,22 @@ class WKWebViewHostApi { } } - Future setUIDelegate(int arg_identifier, int? arg_uiDelegateIdentifier) async { + Future setUIDelegate( + int arg_identifier, int? arg_uiDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_uiDelegateIdentifier]) as Map?; + await channel.send([arg_identifier, arg_uiDelegateIdentifier]) + 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?, @@ -1825,18 +1994,22 @@ class WKWebViewHostApi { } } - Future setNavigationDelegate(int arg_identifier, int? arg_navigationDelegateIdentifier) async { + Future setNavigationDelegate( + int arg_identifier, int? arg_navigationDelegateIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_navigationDelegateIdentifier]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_navigationDelegateIdentifier]) + 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?, @@ -1849,7 +2022,8 @@ class WKWebViewHostApi { Future getUrl(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1858,7 +2032,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?, @@ -1871,7 +2046,8 @@ class WKWebViewHostApi { Future getEstimatedProgress(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1880,7 +2056,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?, @@ -1896,18 +2073,21 @@ class WKWebViewHostApi { } } - Future loadRequest(int arg_identifier, NSUrlRequestData arg_request) async { + Future loadRequest( + int arg_identifier, NSUrlRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_request]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadRequest', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -1918,18 +2098,22 @@ class WKWebViewHostApi { } } - Future loadHtmlString(int arg_identifier, String arg_string, String? arg_baseUrl) async { + Future loadHtmlString( + int arg_identifier, String arg_string, String? arg_baseUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_string, arg_baseUrl]) as Map?; + await channel.send([arg_identifier, 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?, @@ -1940,18 +2124,22 @@ class WKWebViewHostApi { } } - Future loadFileUrl(int arg_identifier, String arg_url, String arg_readAccessUrl) async { + Future loadFileUrl( + int arg_identifier, String arg_url, String arg_readAccessUrl) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_url, arg_readAccessUrl]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -1964,16 +2152,18 @@ class WKWebViewHostApi { Future loadFlutterAsset(int arg_identifier, String arg_key) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_key]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -1986,7 +2176,8 @@ class WKWebViewHostApi { Future canGoBack(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -1995,7 +2186,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?, @@ -2013,7 +2205,8 @@ class WKWebViewHostApi { Future canGoForward(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2022,7 +2215,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?, @@ -2040,7 +2234,8 @@ class WKWebViewHostApi { Future goBack(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2049,7 +2244,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?, @@ -2062,7 +2258,8 @@ class WKWebViewHostApi { Future goForward(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2071,7 +2268,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?, @@ -2084,7 +2282,8 @@ class WKWebViewHostApi { Future reload(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2093,7 +2292,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?, @@ -2106,7 +2306,8 @@ class WKWebViewHostApi { Future getTitle(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2115,7 +2316,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?, @@ -2126,18 +2328,22 @@ class WKWebViewHostApi { } } - Future setAllowsBackForwardNavigationGestures(int arg_identifier, bool arg_allow) async { + Future setAllowsBackForwardNavigationGestures( + int arg_identifier, bool arg_allow) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_allow]) as Map?; + 'dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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?, @@ -2148,18 +2354,22 @@ class WKWebViewHostApi { } } - Future setCustomUserAgent(int arg_identifier, String? arg_userAgent) async { + Future setCustomUserAgent( + int arg_identifier, String? arg_userAgent) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_userAgent]) as Map?; + await channel.send([arg_identifier, 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?, @@ -2170,18 +2380,22 @@ class WKWebViewHostApi { } } - Future evaluateJavaScript(int arg_identifier, String arg_javaScriptString) async { + Future evaluateJavaScript( + int arg_identifier, String arg_javaScriptString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, binaryMessenger: _binaryMessenger); + 'dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript', codec, + binaryMessenger: _binaryMessenger); final Map? replyMap = - await channel.send([arg_identifier, arg_javaScriptString]) as Map?; + await channel.send([arg_identifier, 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?, @@ -2201,7 +2415,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; @@ -2209,7 +2424,8 @@ class WKUIDelegateHostApi { Future create(int arg_identifier) 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_identifier]) as Map?; if (replyMap == null) { @@ -2218,7 +2434,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?, @@ -2237,60 +2454,68 @@ class _WKUIDelegateFlutterApiCodec extends StandardMessageCodec { if (value is NSUrlRequestData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is WKFrameInfoData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSUrlRequestData.decode(readValue(buffer)!); - - case 129: + + case 129: return WKFrameInfoData.decode(readValue(buffer)!); - - case 130: + + case 130: return WKNavigationActionData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class WKUIDelegateFlutterApi { static const MessageCodec codec = _WKUIDelegateFlutterApiCodec(); - void onCreateWebView(int identifier, int webViewIdentifier, int configurationIdentifier, WKNavigationActionData navigationAction); - static void setup(WKUIDelegateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + void onCreateWebView(int identifier, int webViewIdentifier, + int configurationIdentifier, WKNavigationActionData navigationAction); + static void setup(WKUIDelegateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[2] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); - final WKNavigationActionData? arg_navigationAction = (args[3] as WKNavigationActionData?); - assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, arg_configurationIdentifier!, arg_navigationAction!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null int.'); + final WKNavigationActionData? arg_navigationAction = + (args[3] as WKNavigationActionData?); + assert(arg_navigationAction != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, + arg_configurationIdentifier!, arg_navigationAction!); return; }); } @@ -2305,27 +2530,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); - } } } @@ -2334,24 +2557,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_identifier, int arg_websiteDataStoreIdentifier) async { + Future createFromWebsiteDataStore( + int arg_identifier, int arg_websiteDataStoreIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_websiteDataStoreIdentifier]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', + codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, arg_websiteDataStoreIdentifier]) + 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?, @@ -2362,18 +2591,21 @@ class WKHttpCookieStoreHostApi { } } - Future setCookie(int arg_identifier, NSHttpCookieData arg_cookie) async { + Future setCookie( + int arg_identifier, NSHttpCookieData arg_cookie) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_identifier, arg_cookie]) as Map?; + 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie', codec, + binaryMessenger: _binaryMessenger); + final Map? replyMap = await channel + .send([arg_identifier, 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/test/src/common/test_web_kit.pigeon.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.pigeon.dart index 8fd67e036afa..587cae44fc10 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 identifier, int configurationIdentifier); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); void createDefaultDataStore(int identifier); - Future removeDataOfTypes(int identifier, List dataTypes, double modificationTimeInSecondsSinceEpoch); - static void setup(TestWKWebsiteDataStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + Future removeDataOfTypes( + int identifier, + List dataTypes, + double modificationTimeInSecondsSinceEpoch); + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); api.createDefaultDataStore(arg_identifier!); return {}; }); @@ -81,20 +97,29 @@ 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); - final List? arg_dataTypes = (args[1] as List?)?.cast(); - assert(arg_dataTypes != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); - final double? arg_modificationTimeInSecondsSinceEpoch = (args[2] as double?); - assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null int.'); + final List? arg_dataTypes = + (args[1] as List?)?.cast(); + assert(arg_dataTypes != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null List.'); + final double? arg_modificationTimeInSecondsSinceEpoch = + (args[2] as double?); + assert(arg_modificationTimeInSecondsSinceEpoch != null, + 'Argument for dev.flutter.pigeon.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); + final bool output = await api.removeDataOfTypes(arg_identifier!, + arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); return {'result': output}; }); } @@ -105,23 +130,28 @@ abstract class TestWKWebsiteDataStoreHostApi { class _TestUIViewHostApiCodec extends StandardMessageCodec { const _TestUIViewHostApiCodec(); } + abstract class TestUIViewHostApi { static const MessageCodec codec = _TestUIViewHostApiCodec(); void setBackgroundColor(int identifier, int? value); void setOpaque(int identifier, bool opaque); - static void setup(TestUIViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestUIViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.UIViewHostApi.setBackgroundColor', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); api.setBackgroundColor(arg_identifier!, arg_value); return {}; @@ -130,17 +160,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null int.'); final bool? arg_opaque = (args[1] as bool?); - assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); + assert(arg_opaque != null, + 'Argument for dev.flutter.pigeon.UIViewHostApi.setOpaque was null, expected non-null bool.'); api.setOpaque(arg_identifier!, arg_opaque!); return {}; }); @@ -152,6 +186,7 @@ abstract class TestUIViewHostApi { class _TestUIScrollViewHostApiCodec extends StandardMessageCodec { const _TestUIScrollViewHostApiCodec(); } + abstract class TestUIScrollViewHostApi { static const MessageCodec codec = _TestUIScrollViewHostApiCodec(); @@ -159,20 +194,25 @@ abstract class TestUIScrollViewHostApi { List getContentOffset(int identifier); void scrollBy(int identifier, double x, double y); void setContentOffset(int identifier, double x, double y); - static void setup(TestUIScrollViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return {}; }); @@ -180,15 +220,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); final List output = api.getContentOffset(arg_identifier!); return {'result': output}; }); @@ -196,19 +239,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); api.scrollBy(arg_identifier!, arg_x!, arg_y!); return {}; }); @@ -216,19 +264,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null int.'); final double? arg_x = (args[1] as double?); - assert(arg_x != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); final double? arg_y = (args[2] as double?); - assert(arg_y != null, 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); api.setContentOffset(arg_identifier!, arg_x!, arg_y!); return {}; }); @@ -244,42 +297,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 identifier); void createFromWebView(int identifier, int webViewIdentifier); void setAllowsInlineMediaPlayback(int identifier, bool allow); - void setMediaTypesRequiringUserActionForPlayback(int identifier, List types); - static void setup(TestWKWebViewConfigurationHostApi? api, {BinaryMessenger? binaryMessenger}) { + void setMediaTypesRequiringUserActionForPlayback( + int identifier, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -287,17 +346,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); final int? arg_webViewIdentifier = (args[1] as int?); - assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); + assert(arg_webViewIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); return {}; }); @@ -305,17 +369,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); return {}; }); @@ -323,18 +392,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); - final List? arg_types = (args[1] as List?)?.cast(); - assert(arg_types != null, 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback(arg_identifier!, arg_types!); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null int.'); + final List? arg_types = + (args[1] as List?) + ?.cast(); + assert(arg_types != null, + 'Argument for dev.flutter.pigeon.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); + api.setMediaTypesRequiringUserActionForPlayback( + arg_identifier!, arg_types!); return {}; }); } @@ -349,91 +426,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 identifier, int configurationIdentifier); - void addScriptMessageHandler(int identifier, int handlerIdentifier, String name); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); + void addScriptMessageHandler( + int identifier, int handlerIdentifier, String name); void removeScriptMessageHandler(int identifier, String name); void removeAllScriptMessageHandlers(int identifier); void addUserScript(int identifier, WKUserScriptData userScript); void removeAllUserScripts(int identifier); - static void setup(TestWKUserContentControllerHostApi? api, {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final int? arg_handlerIdentifier = (args[1] as int?); - assert(arg_handlerIdentifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); + assert(arg_handlerIdentifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[2] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler(arg_identifier!, arg_handlerIdentifier!, arg_name!); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); + api.addScriptMessageHandler( + arg_identifier!, arg_handlerIdentifier!, arg_name!); return {}; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null int.'); final String? arg_name = (args[1] as String?); - assert(arg_name != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); + assert(arg_name != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); api.removeScriptMessageHandler(arg_identifier!, arg_name!); return {}; }); @@ -441,15 +539,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); api.removeAllScriptMessageHandlers(arg_identifier!); return {}; }); @@ -457,17 +559,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); - final WKUserScriptData? arg_userScript = (args[1] as WKUserScriptData?); - assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null int.'); + final WKUserScriptData? arg_userScript = + (args[1] as WKUserScriptData?); + assert(arg_userScript != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); api.addUserScript(arg_identifier!, arg_userScript!); return {}; }); @@ -475,15 +583,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); api.removeAllUserScripts(arg_identifier!); return {}; }); @@ -495,43 +607,56 @@ abstract class TestWKUserContentControllerHostApi { class _TestWKPreferencesHostApiCodec extends StandardMessageCodec { const _TestWKPreferencesHostApiCodec(); } + abstract class TestWKPreferencesHostApi { static const MessageCodec codec = _TestWKPreferencesHostApiCodec(); - void createFromWebViewConfiguration(int identifier, int configurationIdentifier); + void createFromWebViewConfiguration( + int identifier, int configurationIdentifier); void setJavaScriptEnabled(int identifier, bool enabled); - static void setup(TestWKPreferencesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKPreferencesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration(arg_identifier!, arg_configurationIdentifier!); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); - assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); + assert(arg_enabled != null, + 'Argument for dev.flutter.pigeon.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); return {}; }); @@ -543,22 +668,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 identifier); - static void setup(TestWKScriptMessageHandlerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKScriptMessageHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -570,22 +701,28 @@ 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 identifier); - static void setup(TestWKNavigationDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKNavigationDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKNavigationDelegateHostApi.create', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKNavigationDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -601,41 +738,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 identifier); - void addObserver(int identifier, int observerIdentifier, String keyPath, List options); + void addObserver(int identifier, int observerIdentifier, String keyPath, + List options); void removeObserver(int identifier, int observerIdentifier, String keyPath); - static void setup(TestNSObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestNSObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.NSObjectHostApi.dispose', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.dispose was null, expected non-null int.'); api.dispose(arg_identifier!); return {}; }); @@ -643,42 +785,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); - final List? arg_options = (args[3] as List?)?.cast(); - assert(arg_options != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!, arg_options!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null String.'); + final List? arg_options = + (args[3] as List?) + ?.cast(); + assert(arg_options != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.addObserver was null, expected non-null List.'); + api.addObserver(arg_identifier!, arg_observerIdentifier!, + arg_keyPath!, arg_options!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final int? arg_observerIdentifier = (args[1] as int?); - assert(arg_observerIdentifier != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); + assert(arg_observerIdentifier != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null int.'); final String? arg_keyPath = (args[2] as String?); - assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver(arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + assert(arg_keyPath != null, + 'Argument for dev.flutter.pigeon.NSObjectHostApi.removeObserver was null, expected non-null String.'); + api.removeObserver( + arg_identifier!, arg_observerIdentifier!, arg_keyPath!); return {}; }); } @@ -693,114 +850,101 @@ class _TestWKWebViewHostApiCodec extends StandardMessageCodec { if (value is NSErrorData) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookieData) { + } else if (value is NSHttpCookieData) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is NSHttpCookiePropertyKeyEnumData) { + } else if (value is NSHttpCookiePropertyKeyEnumData) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueChangeKeyEnumData) { + } else if (value is NSKeyValueChangeKeyEnumData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is NSKeyValueObservingOptionsEnumData) { + } else if (value is NSKeyValueObservingOptionsEnumData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is NSUrlRequestData) { + } else if (value is NSUrlRequestData) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is WKAudiovisualMediaTypeEnumData) { + } else if (value is WKAudiovisualMediaTypeEnumData) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WKFrameInfoData) { + } else if (value is WKFrameInfoData) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionData) { + } else if (value is WKNavigationActionData) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else - if (value is WKNavigationActionPolicyEnumData) { + } else if (value is WKNavigationActionPolicyEnumData) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else - if (value is WKScriptMessageData) { + } else if (value is WKScriptMessageData) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptData) { + } else if (value is WKUserScriptData) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else - if (value is WKUserScriptInjectionTimeEnumData) { + } else if (value is WKUserScriptInjectionTimeEnumData) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else - if (value is WKWebsiteDataTypeEnumData) { + } else if (value is WKWebsiteDataTypeEnumData) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NSErrorData.decode(readValue(buffer)!); - - case 129: + + case 129: return NSHttpCookieData.decode(readValue(buffer)!); - - case 130: + + case 130: return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!); - - case 131: + + case 131: return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!); - - case 132: + + case 132: return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!); - - case 133: + + case 133: return NSUrlRequestData.decode(readValue(buffer)!); - - case 134: + + case 134: return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!); - - case 135: + + case 135: return WKFrameInfoData.decode(readValue(buffer)!); - - case 136: + + case 136: return WKNavigationActionData.decode(readValue(buffer)!); - - case 137: + + case 137: return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!); - - case 138: + + case 138: return WKScriptMessageData.decode(readValue(buffer)!); - - case 139: + + case 139: return WKUserScriptData.decode(readValue(buffer)!); - - case 140: + + case 140: return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!); - - case 141: + + case 141: return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!); - - default: + + default: return super.readValueOfType(type, buffer); - } } } + abstract class TestWKWebViewHostApi { static const MessageCodec codec = _TestWKWebViewHostApiCodec(); @@ -822,20 +966,25 @@ abstract class TestWKWebViewHostApi { void setAllowsBackForwardNavigationGestures(int identifier, bool allow); void setCustomUserAgent(int identifier, String? userAgent); Future evaluateJavaScript(int identifier, String javaScriptString); - static void setup(TestWKWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); final int? arg_configurationIdentifier = (args[1] as int?); - assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); + assert(arg_configurationIdentifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.create was null, expected non-null int.'); api.create(arg_identifier!, arg_configurationIdentifier!); return {}; }); @@ -843,15 +992,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); return {}; @@ -860,32 +1012,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate(arg_identifier!, arg_navigationDelegateIdentifier); + api.setNavigationDelegate( + arg_identifier!, arg_navigationDelegateIdentifier); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getUrl was null, expected non-null int.'); final String? output = api.getUrl(arg_identifier!); return {'result': output}; }); @@ -893,15 +1052,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); final double output = api.getEstimatedProgress(arg_identifier!); return {'result': output}; }); @@ -909,17 +1071,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null int.'); final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); - assert(arg_request != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); api.loadRequest(arg_identifier!, arg_request!); return {}; }); @@ -927,17 +1093,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null int.'); final String? arg_string = (args[1] as String?); - assert(arg_string != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); + assert(arg_string != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); return {}; @@ -946,19 +1116,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null int.'); final String? arg_url = (args[1] as String?); - assert(arg_url != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_url != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); final String? arg_readAccessUrl = (args[2] as String?); - assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); + assert(arg_readAccessUrl != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); return {}; }); @@ -966,17 +1141,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null int.'); final String? arg_key = (args[1] as String?); - assert(arg_key != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); + assert(arg_key != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); api.loadFlutterAsset(arg_identifier!, arg_key!); return {}; }); @@ -984,15 +1163,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoBack was null, expected non-null int.'); final bool output = api.canGoBack(arg_identifier!); return {'result': output}; }); @@ -1000,15 +1182,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.canGoForward was null, expected non-null int.'); final bool output = api.canGoForward(arg_identifier!); return {'result': output}; }); @@ -1016,15 +1201,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goBack was null, expected non-null int.'); api.goBack(arg_identifier!); return {}; }); @@ -1032,15 +1220,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.goForward was null, expected non-null int.'); api.goForward(arg_identifier!); return {}; }); @@ -1048,15 +1239,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.reload was null, expected non-null int.'); api.reload(arg_identifier!); return {}; }); @@ -1064,15 +1258,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.getTitle was null, expected non-null int.'); final String? output = api.getTitle(arg_identifier!); return {'result': output}; }); @@ -1080,33 +1277,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null int.'); final bool? arg_allow = (args[1] as bool?); - assert(arg_allow != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures(arg_identifier!, arg_allow!); + assert(arg_allow != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); + api.setAllowsBackForwardNavigationGestures( + arg_identifier!, arg_allow!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); api.setCustomUserAgent(arg_identifier!, arg_userAgent); return {}; @@ -1115,18 +1321,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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null int.'); final String? arg_javaScriptString = (args[1] as String?); - assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript(arg_identifier!, arg_javaScriptString!); + assert(arg_javaScriptString != null, + 'Argument for dev.flutter.pigeon.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); + final Object? output = await api.evaluateJavaScript( + arg_identifier!, arg_javaScriptString!); return {'result': output}; }); } @@ -1137,22 +1348,27 @@ abstract class TestWKWebViewHostApi { class _TestWKUIDelegateHostApiCodec extends StandardMessageCodec { const _TestWKUIDelegateHostApiCodec(); } + abstract class TestWKUIDelegateHostApi { static const MessageCodec codec = _TestWKUIDelegateHostApiCodec(); void create(int identifier); - static void setup(TestWKUIDelegateHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKUIDelegateHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKUIDelegateHostApi.create', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKUIDelegateHostApi.create was null, expected non-null int.'); api.create(arg_identifier!); return {}; }); @@ -1168,67 +1384,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 identifier, int websiteDataStoreIdentifier); + void createFromWebsiteDataStore( + int identifier, int websiteDataStoreIdentifier); Future setCookie(int identifier, NSHttpCookieData cookie); - static void setup(TestWKHttpCookieStoreHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWKHttpCookieStoreHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore', codec, 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); final int? arg_websiteDataStoreIdentifier = (args[1] as int?); - assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore(arg_identifier!, arg_websiteDataStoreIdentifier!); + assert(arg_websiteDataStoreIdentifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); + api.createFromWebsiteDataStore( + arg_identifier!, arg_websiteDataStoreIdentifier!); return {}; }); } } { 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_identifier = (args[0] as int?); - assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null int.'); final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); - assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); + assert(arg_cookie != null, + 'Argument for dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); await api.setCookie(arg_identifier!, arg_cookie!); return {}; }); From 6f9dbc12fc73a4e4a6c93995f10bebaba750976a Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:52:04 -0700 Subject: [PATCH 20/31] store binary messenger --- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 2 ++ 1 file changed, 2 insertions(+) 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 5513b8b9145d..2f72f1c38dd1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -9,6 +9,7 @@ @interface FWFWebViewConfigurationFlutterApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. +@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -17,6 +18,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen instanceManager:(FWFInstanceManager *)instanceManager { self = [self initWithBinaryMessenger:binaryMessenger]; if (self) { + _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; From 8bc168e720e108c665da43aca784c5bfc6dc5933 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 10 Jun 2022 13:01:14 -0700 Subject: [PATCH 21/31] fix configuration identifier --- .../ios/Classes/FWFUIDelegateHostApi.m | 13 ++++++++----- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 2 -- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index b935087b1874..21ae2a08a1da 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -33,21 +33,24 @@ - (void)onCreateWebViewForDelegate:(FWFUIDelegate *)instance configuration:(WKWebViewConfiguration *)configuration navigationAction:(WKNavigationAction *)navigationAction completion:(void (^)(NSError *_Nullable))completion { - NSNumber *configurationIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); - FWFWKNavigationActionData *navigationActionData = - FWFWKNavigationActionDataFromNavigationAction(navigationAction); - if (![self.instanceManager containsInstance:configuration]) { FWFWebViewConfigurationFlutterApiImpl *flutterApi = [[FWFWebViewConfigurationFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; + [flutterApi createWithConfiguration:configuration completion:^(NSError *error) { NSAssert(!error, @"%@", error); }]; } + + FWFWKNavigationActionData *navigationActionData = + FWFWKNavigationActionDataFromNavigationAction(navigationAction); + + NSNumber *configurationIdentifier = + @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); + [self onCreateWebViewForDelegateWithIdentifier:@([self identifierForDelegate:instance]) webViewIdentifier: @([self.instanceManager 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 2f72f1c38dd1..5513b8b9145d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -9,7 +9,6 @@ @interface FWFWebViewConfigurationFlutterApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -18,7 +17,6 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen instanceManager:(FWFInstanceManager *)instanceManager { self = [self initWithBinaryMessenger:binaryMessenger]; if (self) { - _binaryMessenger = binaryMessenger; _instanceManager = instanceManager; } return self; From c8585c0ef241e1ce6e3d8e7091e9a939ed65b0dd Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:08:20 -0700 Subject: [PATCH 22/31] new fix for nserror --- .../ios/Classes/FWFWebViewHostApi.m | 9 +++-- .../lib/src/web_kit/web_kit_api_impls.dart | 21 +++++++++--- .../lib/src/web_kit_webview_widget.dart | 34 +++++++------------ .../test/src/web_kit_webview_widget_test.dart | 17 +++++----- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index ffc746b0779d..480524b8dce3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -170,11 +170,12 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie evaluateJavaScript:javaScriptString completionHandler:^(id _Nullable result, NSError *_Nullable error) { id returnValue = nil; + FlutterError *flutterError = nil; if (!error) { if (!result || [result isKindOfClass:[NSString class]] || [result isKindOfClass:[NSNumber class]]) { returnValue = result; - } else { + } else if (![result isKindOfClass:[NSNull class]]) { NSString *className = NSStringFromClass([result class]); NSLog(@"Return type of evaluateJavaScript is not directly supported: %@. Returned " @"description of value.", @@ -182,10 +183,12 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie returnValue = [result description]; } } else { - returnValue = FWFNSErrorDataFromNSError(error); + flutterError = [FlutterError errorWithCode:@"FWFEvaluateJavaScriptError" + message:@"Failed evaluating JavaScript." + details:FWFNSErrorDataFromNSError(error)]; } - completion(returnValue, nil); + completion(returnValue, flutterError); }]; } 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 51331c47fdd9..0bdb682da9ad 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 @@ -995,10 +995,23 @@ class WKWebViewHostApiImpl extends WKWebViewHostApi { WKWebView instance, String javaScriptString, ) { - return evaluateJavaScript( - instanceManager.getIdentifier(instance)!, - javaScriptString, - ); + try { + return evaluateJavaScript( + instanceManager.getIdentifier(instance)!, + javaScriptString, + ); + } on PlatformException catch (exception) { + if (exception.details is! NSErrorData) { + rethrow; + } + + throw PlatformException( + code: exception.code, + message: exception.message, + stacktrace: exception.stacktrace, + details: (exception.details as NSErrorData).toNSError(), + ); + } } /// Calls [setNavigationDelegate] with the ids of the provided object instances. 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 db2f7c2d2850..3ce4ae25be80 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 @@ -328,21 +328,18 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { @override Future runJavascript(String javascript) async { - final Object? result = await webView.evaluateJavaScript(javascript); - // WebKit will throw an error when the type of the evaluated value is - // unsupported. This also goes for `null` and `undefined` on iOS 14+. For - // example, when running a void function. For ease of use, this specific - // error is ignored when no return value is expected. - if (result is NSError && - result.code == WKErrorCode.javaScriptResultTypeIsUnsupported) { - return; - } else if (result is NSError) { - throw PlatformException( - code: 'runJavascript_failed', - message: 'Failed running JavaScript', - details: - "JavaScript string was: '$javascript'\n${result.localizedDescription}", - ); + try { + await webView.evaluateJavaScript(javascript); + } on PlatformException catch (exception) { + // WebKit will throw an error when the type of the evaluated value is + // unsupported. This also goes for `null` and `undefined` on iOS 14+. For + // example, when running a void function. For ease of use, this specific + // error is ignored when no return value is expected. + if (exception.details is! NSError || + exception.details.code != + WKErrorCode.javaScriptResultTypeIsUnsupported) { + rethrow; + } } } @@ -354,13 +351,6 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { 'Result of JavaScript execution returned a `null` value. ' 'Use `runJavascript` when expecting a null return value.', ); - } else if (result is NSError) { - throw PlatformException( - code: 'runJavascriptReturningResult_failed', - message: 'Failed running JavaScript', - details: - "JavaScript string was: '$javascript'\n${result.localizedDescription}", - ); } return _asObjectiveCString(result); } 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 0e27ab83bf3a..24155d2a05e1 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 @@ -6,6 +6,7 @@ import 'dart:math'; import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -723,15 +724,15 @@ void main() { (WidgetTester tester) async { await buildWidget(tester); - when(mockWebView.evaluateJavaScript('runJavaScript')).thenAnswer( - (_) => Future.value( - const NSError( - code: WKErrorCode.javaScriptResultTypeIsUnsupported, - domain: '', - localizedDescription: '', - ), + when(mockWebView.evaluateJavaScript('runJavaScript')) + .thenThrow(PlatformException( + code: '', + details: const NSError( + code: WKErrorCode.javaScriptResultTypeIsUnsupported, + domain: '', + localizedDescription: '', ), - ); + )); expect( testController.runJavascript('runJavaScript'), completes, From 37d83008aee2610309c11d722bc2c24e8e80f3bc Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 14 Jun 2022 09:00:24 -0700 Subject: [PATCH 23/31] fix crash --- .../lib/src/web_kit/web_kit_api_impls.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 0bdb682da9ad..f32309073152 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 @@ -994,12 +994,13 @@ class WKWebViewHostApiImpl extends WKWebViewHostApi { Future evaluateJavaScriptForInstances( WKWebView instance, String javaScriptString, - ) { + ) async { try { - return evaluateJavaScript( + final Object? result = await evaluateJavaScript( instanceManager.getIdentifier(instance)!, javaScriptString, ); + return result; } on PlatformException catch (exception) { if (exception.details is! NSErrorData) { rethrow; From e7b9d11b7cc8efa6803a4704e7e6866f04028b77 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 14 Jun 2022 09:01:56 -0700 Subject: [PATCH 24/31] correct import --- .../test/src/common/test_web_kit.pigeon.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 587cae44fc10..a9e5c8bb1db4 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 @@ -12,7 +12,7 @@ import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../../../lib/src/common/web_kit.pigeon.dart'; +import 'package:webview_flutter_wkwebview/src/common/web_kit.pigeon.dart'; class _TestWKWebsiteDataStoreHostApiCodec extends StandardMessageCodec { const _TestWKWebsiteDataStoreHostApiCodec(); From b2892e25721358f53d535c8d34806fbd57bc52ce Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 15 Jun 2022 11:47:51 -0700 Subject: [PATCH 25/31] formatting and test passing --- .../example/ios/RunnerTests/FWFWebViewHostApiTests.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 c5e86b48528d..1061abb78f45 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 @@ -388,8 +388,9 @@ - (void)testEvaluateJavaScriptReturnsNSErrorData { FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init]; [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; - FWFWebViewHostApiImpl *hostAPI = - [[FWFWebViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; + FWFWebViewHostApiImpl *hostAPI = [[FWFWebViewHostApiImpl alloc] + initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger)) + instanceManager:instanceManager]; NSString __block *returnValue; FlutterError __block *returnError; From f40115d3506e2f2ef678373bec5872fd0f9dc4d4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 15 Jun 2022 11:58:37 -0700 Subject: [PATCH 26/31] nonatomic --- .../ios/Classes/FWFNavigationDelegateHostApi.m | 2 +- .../ios/Classes/FWFScriptMessageHandlerHostApi.m | 2 +- .../ios/Classes/FWFUIDelegateHostApi.m | 2 +- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 2 +- .../webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 18a77aab0295..6f6f70d07ec7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -186,7 +186,7 @@ - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { @interface FWFNavigationDelegateHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; +@property(nonatomic weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 5203f0146227..f1ed6f6ac0d8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -65,7 +65,7 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont @interface FWFScriptMessageHandlerHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; +@property(nonatomic weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index dfbb6d39a287..4b91af80f0c1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -86,7 +86,7 @@ - (WKWebView *)webView:(WKWebView *)webView @interface FWFUIDelegateHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; +@property(nonatomic weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 5513b8b9145d..6916e9052f8b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -57,7 +57,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath @interface FWFWebViewConfigurationHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; +@property(nonatomic weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 480524b8dce3..54aa056dd0d4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -61,7 +61,7 @@ - (nonnull UIView *)view { @interface FWFWebViewHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(weak) id binaryMessenger; +@property(nonatomic, weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @property NSBundle *bundle; @property FWFAssetManager *assetManager; From 2a18e2c444ffe0f86d52132fa3d472d38114ae8a Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 15 Jun 2022 12:05:40 -0700 Subject: [PATCH 27/31] duplicate code + missing comma --- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 2 +- .../lib/src/web_kit_webview_widget.dart | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) 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 6916e9052f8b..b7c07ca9150f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -57,7 +57,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath @interface FWFWebViewConfigurationHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(nonatomic weak) id binaryMessenger; +@property(nonatomic, weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end 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 df41c5ab8ab5..ed1912ee7898 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 @@ -347,7 +347,7 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { 'Use `runJavascript` when expecting a null return value.', ); } - return _asObjectiveCString(result); + return result.toString(); } @override @@ -588,10 +588,6 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { stringValues.add(_asObjectiveCString(listValue, inContainer: true)); } return '(${stringValues.join(',')})'; - } else if (value is bool) { - return value ? '1' : '0'; - } else if (value is double && value.truncate() == value) { - return value.truncate().toString(); } else if (value is Map) { final List stringValues = []; for (final MapEntry entry in value.entries) { From 3011abe0bed4b5f87b9d47a7091e150ae9ca412c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 15 Jun 2022 13:18:34 -0700 Subject: [PATCH 28/31] missing commas --- .../ios/Classes/FWFScriptMessageHandlerHostApi.m | 2 +- .../ios/Classes/FWFUIDelegateHostApi.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 f1ed6f6ac0d8..9f36fe723160 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -65,7 +65,7 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont @interface FWFScriptMessageHandlerHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(nonatomic weak) id binaryMessenger; +@property(nonatomic, weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 4b91af80f0c1..139674e461f6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -86,7 +86,7 @@ - (WKWebView *)webView:(WKWebView *)webView @interface FWFUIDelegateHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(nonatomic weak) id binaryMessenger; +@property(nonatomic, weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end From f3f58e3741ca45578ca481d781015381df36b759 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:24:05 -0700 Subject: [PATCH 29/31] another missing comma --- .../ios/Classes/FWFNavigationDelegateHostApi.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6f6f70d07ec7..4b2ea4438c4b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -186,7 +186,7 @@ - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { @interface FWFNavigationDelegateHostApiImpl () // BinaryMessenger and InstanceManager must be weak to prevent a circular reference // with the objects it stores. -@property(nonatomic weak) id binaryMessenger; +@property(nonatomic, weak) id binaryMessenger; @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end From 353cab1c60d7c4b013c3299cf37e445f36706e9c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:09:05 -0700 Subject: [PATCH 30/31] improve weak comments --- .../ios/Classes/FWFHTTPCookieStoreHostApi.m | 3 +-- .../ios/Classes/FWFNavigationDelegateHostApi.m | 8 ++++---- .../ios/Classes/FWFObjectHostApi.m | 6 ++---- .../ios/Classes/FWFPreferencesHostApi.m | 3 +-- .../ios/Classes/FWFScriptMessageHandlerHostApi.m | 8 ++++---- .../ios/Classes/FWFScrollViewHostApi.m | 3 +-- .../ios/Classes/FWFUIDelegateHostApi.m | 10 ++++++---- .../ios/Classes/FWFUIViewHostApi.m | 3 +-- .../ios/Classes/FWFUserContentControllerHostApi.m | 3 +-- .../ios/Classes/FWFWebViewConfigurationHostApi.m | 8 ++++---- .../ios/Classes/FWFWebViewHostApi.m | 5 +++-- .../ios/Classes/FWFWebsiteDataStoreHostApi.m | 3 +-- 12 files changed, 29 insertions(+), 34 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 f51d52679232..79a3a684b805 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -7,8 +7,7 @@ #import "FWFWebsiteDataStoreHostApi.h" @interface FWFHTTPCookieStoreHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 4b2ea4438c4b..1132e02880b2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -7,8 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFNavigationDelegateFlutterApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -184,9 +183,10 @@ - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { @end @interface FWFNavigationDelegateHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end 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 8d4b45947ea5..c88b2f4e56cb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -6,8 +6,7 @@ #import "FWFDataConverters.h" @interface FWFObjectFlutterApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -75,8 +74,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath @end @interface FWFObjectHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 514a221746f5..1a10c08eec4a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -6,8 +6,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFPreferencesHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 9f36fe723160..d9e8b934a79a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -6,8 +6,7 @@ #import "FWFDataConverters.h" @interface FWFScriptMessageHandlerFlutterApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -63,9 +62,10 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont @end @interface FWFScriptMessageHandlerHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end 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 09454666e900..a32e9565b514 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -6,8 +6,7 @@ #import "FWFWebViewHostApi.h" @interface FWFScrollViewHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 index 139674e461f6..60e7ad11965c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -6,9 +6,10 @@ #import "FWFDataConverters.h" @interface FWFUIDelegateFlutterApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -84,9 +85,10 @@ - (WKWebView *)webView:(WKWebView *)webView @end @interface FWFUIDelegateHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end 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 7a7e4fa93d84..a990561c4fba 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -5,8 +5,7 @@ #import "FWFUIViewHostApi.h" @interface FWFUIViewHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 6fb734e63225..08bbaa68c99c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -7,8 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFUserContentControllerHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @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 b7c07ca9150f..a083a2a031ef 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -7,8 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFWebViewConfigurationFlutterApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end @@ -55,9 +54,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath @end @interface FWFWebViewConfigurationHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index 54aa056dd0d4..9a8aedd1e646 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -59,9 +59,10 @@ - (nonnull UIView *)view { @end @interface FWFWebViewHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// BinaryMessenger must be weak to prevent a circular reference with the host API it +// references. @property(nonatomic, weak) id binaryMessenger; +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @property NSBundle *bundle; @property FWFAssetManager *assetManager; 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 92c47a6afd3a..5398d14d4e8b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -7,8 +7,7 @@ #import "FWFWebViewConfigurationHostApi.h" @interface FWFWebsiteDataStoreHostApiImpl () -// BinaryMessenger and InstanceManager must be weak to prevent a circular reference -// with the objects it stores. +// InstanceManager must be weak to prevent a circular reference with the object it stores. @property(nonatomic, weak) FWFInstanceManager *instanceManager; @end From d92b699298ac0786cc17246c4520f7f9895c5134 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:11:29 -0700 Subject: [PATCH 31/31] formatting --- .../ios/Classes/FWFNavigationDelegateHostApi.h | 1 + .../webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h | 2 ++ .../ios/Classes/FWFScriptMessageHandlerHostApi.h | 1 + .../ios/Classes/FWFUIDelegateHostApi.h | 2 ++ .../ios/Classes/FWFWebViewConfigurationHostApi.h | 2 ++ .../webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h | 2 ++ 6 files changed, 10 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h index da5939a3abed..90e55417cd1b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.h @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFNavigationDelegate : FWFObject @property(readonly, nonnull, nonatomic) FWFNavigationDelegateFlutterApiImpl *navigationDelegateAPI; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h index 5453a2b256d1..0b740a524cef 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.h @@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFObjectFlutterApiImpl : FWFNSObjectFlutterApi - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; + - (void)observeValueForObject:(NSObject *)instance keyPath:(NSString *)keyPath object:(NSObject *)object @@ -29,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFObject : NSObject @property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h index d608b0ef0149..9c5769e4658b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.h @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFScriptMessageHandler : FWFObject @property(readonly, nonnull, nonatomic) FWFScriptMessageHandlerFlutterApiImpl *scriptMessageHandlerAPI; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @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 index 7492ca70d549..7b6b4eec9b8e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.h @@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFUIDelegateFlutterApiImpl : FWFWKUIDelegateFlutterApi @property(readonly, nonatomic) FWFWebViewConfigurationFlutterApiImpl *webViewConfigurationFlutterApi; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @end @@ -29,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFUIDelegate : FWFObject @property(readonly, nonnull, nonatomic) FWFUIDelegateFlutterApiImpl *UIDelegateAPI; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @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 index b2978211c93f..f1e62cc0cba3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.h @@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFWebViewConfigurationFlutterApiImpl : FWFWKWebViewConfigurationFlutterApi - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; + - (void)createWithConfiguration:(WKWebViewConfiguration *)configuration completion:(void (^)(NSError *_Nullable))completion; @end @@ -28,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFWebViewConfiguration : WKWebViewConfiguration @property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h index 99e9961537c4..f1bb59bcb9ae 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.h @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface FWFWebView : WKWebView @property(readonly, nonnull, nonatomic) FWFObjectFlutterApiImpl *objectApi; + - (instancetype)initWithFrame:(CGRect)frame configuration:(nonnull WKWebViewConfiguration *)configuration binaryMessenger:(id)binaryMessenger @@ -39,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFWebViewHostApiImpl : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager; + - (instancetype)initWithBinaryMessenger:(id)binaryMessenger instanceManager:(FWFInstanceManager *)instanceManager bundle:(NSBundle *)bundle