updated macos docs, added getContentWidth WebView method

This commit is contained in:
Lorenzo Pichilli 2022-10-18 18:12:33 +02:00
parent 3e3ba55a30
commit 652ee52c75
67 changed files with 3941 additions and 1171 deletions

View File

@ -1,3 +1,14 @@
## 6.0.0-beta.3
- Added MacOS support
- Added `PrintJobInfo.printer`
- Added `getContentWidth` WebView method
### BREAKING CHANGES
- Removed `PrintJobInfo.printerId`
- All `InAppWebViewSettings`, `InAppBrowserSettings` properties are optionals
## 6.0.0-beta.2 ## 6.0.0-beta.2
- Fixed web example - Fixed web example

View File

@ -95,6 +95,7 @@ public class InAppBrowserSettings implements ISettings<InAppBrowserActivity> {
@Override @Override
public Map<String, Object> getRealSettings(@NonNull InAppBrowserActivity inAppBrowserActivity) { public Map<String, Object> getRealSettings(@NonNull InAppBrowserActivity inAppBrowserActivity) {
Map<String, Object> realSettings = toMap(); Map<String, Object> realSettings = toMap();
realSettings.put("hidden", inAppBrowserActivity.isHidden);
realSettings.put("hideToolbarTop", inAppBrowserActivity.actionBar == null || !inAppBrowserActivity.actionBar.isShowing()); realSettings.put("hideToolbarTop", inAppBrowserActivity.actionBar == null || !inAppBrowserActivity.actionBar.isShowing());
realSettings.put("hideUrlBar", inAppBrowserActivity.menu == null || !inAppBrowserActivity.menu.findItem(R.id.menu_search).isVisible()); realSettings.put("hideUrlBar", inAppBrowserActivity.menu == null || !inAppBrowserActivity.menu.findItem(R.id.menu_search).isVisible());
realSettings.put("hideProgressBar", inAppBrowserActivity.progressBar == null || inAppBrowserActivity.progressBar.getMax() == 0); realSettings.put("hideProgressBar", inAppBrowserActivity.progressBar == null || inAppBrowserActivity.progressBar.getMax() == 0);

View File

@ -69,6 +69,7 @@ public interface InAppWebViewInterface {
String printCurrentPage(@Nullable PrintJobSettings settings); String printCurrentPage(@Nullable PrintJobSettings settings);
int getContentHeight(); int getContentHeight();
void getContentHeight(ValueCallback<Integer> callback); void getContentHeight(ValueCallback<Integer> callback);
void getContentWidth(ValueCallback<Integer> callback);
void zoomBy(float zoomFactor); void zoomBy(float zoomFactor);
String getOriginalUrl(); String getOriginalUrl();
void getSelectedText(ValueCallback<String> callback); void getSelectedText(ValueCallback<String> callback);

View File

@ -263,6 +263,14 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
result.notImplemented(); result.notImplemented();
} }
break; break;
case isHidden:
if (webView != null && webView.getInAppBrowserDelegate() instanceof InAppBrowserActivity) {
InAppBrowserActivity inAppBrowserActivity = (InAppBrowserActivity) webView.getInAppBrowserDelegate();
result.success(inAppBrowserActivity.isHidden);
} else {
result.notImplemented();
}
break;
case getCopyBackForwardList: case getCopyBackForwardList:
result.success((webView != null) ? webView.getCopyBackForwardList() : null); result.success((webView != null) ? webView.getCopyBackForwardList() : null);
break; break;
@ -370,6 +378,18 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
result.success(null); result.success(null);
} }
break; break;
case getContentWidth:
if (webView instanceof InAppWebView) {
webView.getContentWidth(new ValueCallback<Integer>() {
@Override
public void onReceiveValue(@Nullable Integer contentWidth) {
result.success(contentWidth);
}
});
} else {
result.success(null);
}
break;
case zoomBy: case zoomBy:
if (webView != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (webView != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
double zoomFactor = (double) call.argument("zoomFactor"); double zoomFactor = (double) call.argument("zoomFactor");

View File

@ -27,6 +27,7 @@ public enum WebViewChannelDelegateMethods {
close, close,
show, show,
hide, hide,
isHidden,
getCopyBackForwardList, getCopyBackForwardList,
startSafeBrowsing, startSafeBrowsing,
clearCache, clearCache,
@ -46,6 +47,7 @@ public enum WebViewChannelDelegateMethods {
resumeTimers, resumeTimers,
printCurrentPage, printCurrentPage,
getContentHeight, getContentHeight,
getContentWidth,
zoomBy, zoomBy,
getOriginalUrl, getOriginalUrl,
getZoomScale, getZoomScale,

View File

@ -1910,6 +1910,19 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
callback.onReceiveValue(getContentHeight()); callback.onReceiveValue(getContentHeight());
} }
public void getContentWidth(final ValueCallback<Integer> callback) {
evaluateJavascript("document.documentElement.scrollWidth;", new ValueCallback<String>() {
@Override
public void onReceiveValue(@Nullable String value) {
Integer contentWidth = null;
if (value != null && !value.equalsIgnoreCase("null")) {
contentWidth = Integer.parseInt(value);
}
callback.onReceiveValue(contentWidth);
}
});
}
@Override @Override
public void getHitTestResult(ValueCallback<com.pichillilorenzo.flutter_inappwebview.types.HitTestResult> callback) { public void getHitTestResult(ValueCallback<com.pichillilorenzo.flutter_inappwebview.types.HitTestResult> callback) {
callback.onReceiveValue(com.pichillilorenzo.flutter_inappwebview.types.HitTestResult.fromWebViewHitTestResult(getHitTestResult())); callback.onReceiveValue(com.pichillilorenzo.flutter_inappwebview.types.HitTestResult.fromWebViewHitTestResult(getHitTestResult()));

View File

@ -1,3 +1,7 @@
## 1.1.0
- Added `ExchangeableObject.copyMethod`.
## 1.0.0 ## 1.0.0
Initial release. Initial release.

View File

@ -4,6 +4,7 @@ class ExchangeableObject {
final bool fromMapFactory; final bool fromMapFactory;
final bool nullableFromMapFactory; final bool nullableFromMapFactory;
final bool toStringMethod; final bool toStringMethod;
final bool copyMethod;
const ExchangeableObject({ const ExchangeableObject({
this.toMapMethod = true, this.toMapMethod = true,
@ -11,5 +12,6 @@ class ExchangeableObject {
this.fromMapFactory = true, this.fromMapFactory = true,
this.nullableFromMapFactory = true, this.nullableFromMapFactory = true,
this.toStringMethod = true, this.toStringMethod = true,
this.copyMethod = false
}); });
} }

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview_internal_annotations name: flutter_inappwebview_internal_annotations
description: Internal annotations used by the generator of flutter_inappwebview plugin description: Internal annotations used by the generator of flutter_inappwebview plugin
version: 1.0.0 version: 1.1.0
homepage: https://github.com/pichillilorenzo/flutter_inappwebview homepage: https://github.com/pichillilorenzo/flutter_inappwebview
environment: environment:

View File

@ -443,6 +443,14 @@ class ExchangeableObjectGenerator
classBuffer.writeln('}'); classBuffer.writeln('}');
} }
if (annotation.read("copyMethod").boolValue && (!visitor.methods.containsKey("copy") ||
Util.methodHasIgnore(visitor.methods['copy']!))) {
classBuffer.writeln('///Returns a copy of $extClassName.');
classBuffer.writeln('$extClassName copy() {');
classBuffer.writeln('return $extClassName.fromMap(toMap()) ?? $extClassName();');
classBuffer.writeln('}');
}
if (annotation.read("toStringMethod").boolValue && (!visitor.methods.containsKey("toString") || if (annotation.read("toStringMethod").boolValue && (!visitor.methods.containsKey("toString") ||
Util.methodHasIgnore(visitor.methods['toString']!))) { Util.methodHasIgnore(visitor.methods['toString']!))) {
classBuffer.writeln('@override'); classBuffer.writeln('@override');

View File

@ -187,7 +187,7 @@ packages:
name: flutter_inappwebview_internal_annotations name: flutter_inappwebview_internal_annotations
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.0"
frontend_server_client: frontend_server_client:
dependency: transitive dependency: transitive
description: description:

View File

@ -12,7 +12,7 @@ dependencies:
sdk: flutter sdk: flutter
build: ^2.3.1 build: ^2.3.1
source_gen: ^1.2.5 source_gen: ^1.2.5
flutter_inappwebview_internal_annotations: ^1.0.0 flutter_inappwebview_internal_annotations: ^1.1.0
dev_dependencies: dev_dependencies:
build_runner: ^2.2.1 build_runner: ^2.2.1

View File

@ -0,0 +1,32 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_test/flutter_test.dart';
import '../constants.dart';
import '../util.dart';
void hideAndShow() {
final shouldSkip = kIsWeb
? true
: ![
TargetPlatform.android,
TargetPlatform.iOS,
TargetPlatform.macOS,
].contains(defaultTargetPlatform);
test('hide and show', () async {
var inAppBrowser = new MyInAppBrowser();
await inAppBrowser.openUrlRequest(
urlRequest: URLRequest(url: TEST_URL_1),
settings: InAppBrowserClassSettings(
browserSettings: InAppBrowserSettings(hidden: true)));
await inAppBrowser.browserCreated.future;
await inAppBrowser.firstPageLoaded.future;
expect(await inAppBrowser.isHidden(), true);
await expectLater(inAppBrowser.show(), completes);
expect(await inAppBrowser.isHidden(), false);
await expectLater(inAppBrowser.hide(), completes);
expect(await inAppBrowser.isHidden(), true);
}, skip: shouldSkip);
}

View File

@ -5,6 +5,7 @@ import 'open_data_and_close.dart';
import 'open_file_and_close.dart'; import 'open_file_and_close.dart';
import 'open_url_and_close.dart'; import 'open_url_and_close.dart';
import 'set_get_settings.dart'; import 'set_get_settings.dart';
import 'hide_and_show.dart';
void main() { void main() {
final shouldSkip = kIsWeb; final shouldSkip = kIsWeb;
@ -14,5 +15,6 @@ void main() {
openFileAndClose(); openFileAndClose();
openDataAndClose(); openDataAndClose();
setGetSettings(); setGetSettings();
hideAndShow();
}, skip: shouldSkip); }, skip: shouldSkip);
} }

View File

@ -3,11 +3,12 @@
export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4" export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4"
export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1" export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false" export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true" export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false" export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json" export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json"

View File

@ -106,7 +106,6 @@ class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {
URLRequest(url: Uri.parse("https://flutter.dev")), URLRequest(url: Uri.parse("https://flutter.dev")),
settings: InAppBrowserClassSettings( settings: InAppBrowserClassSettings(
browserSettings: InAppBrowserSettings( browserSettings: InAppBrowserSettings(
hidden: false,
toolbarTopBackgroundColor: Colors.blue, toolbarTopBackgroundColor: Colors.blue,
presentationStyle: ModalPresentationStyle.POPOVER presentationStyle: ModalPresentationStyle.POPOVER
), ),

View File

@ -56,6 +56,7 @@ public class InAppBrowserManager: ChannelDelegate {
let webViewController = InAppBrowserWebViewController() let webViewController = InAppBrowserWebViewController()
webViewController.browserSettings = browserSettings webViewController.browserSettings = browserSettings
webViewController.isHidden = browserSettings.hidden
webViewController.webViewSettings = webViewSettings webViewController.webViewSettings = webViewSettings
webViewController.previousStatusBarStyle = previousStatusBarStyle webViewController.previousStatusBarStyle = previousStatusBarStyle
return webViewController return webViewController

View File

@ -35,6 +35,7 @@ public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
override func getRealSettings(obj: InAppBrowserWebViewController?) -> [String: Any?] { override func getRealSettings(obj: InAppBrowserWebViewController?) -> [String: Any?] {
var realOptions: [String: Any?] = toMap() var realOptions: [String: Any?] = toMap()
if let inAppBrowserWebViewController = obj { if let inAppBrowserWebViewController = obj {
realOptions["hidden"] = inAppBrowserWebViewController.isHidden
realOptions["hideUrlBar"] = inAppBrowserWebViewController.searchBar.isHidden realOptions["hideUrlBar"] = inAppBrowserWebViewController.searchBar.isHidden
realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["closeButtonCaption"] = inAppBrowserWebViewController.closeButton.title realOptions["closeButtonCaption"] = inAppBrowserWebViewController.closeButton.title

View File

@ -38,6 +38,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega
var previousStatusBarStyle = -1 var previousStatusBarStyle = -1
var initialUserScripts: [[String: Any]] = [] var initialUserScripts: [[String: Any]] = []
var pullToRefreshInitialSettings: [String: Any?] = [:] var pullToRefreshInitialSettings: [String: Any?] = [:]
var isHidden = false
public override func loadView() { public override func loadView() {
let channel = FlutterMethodChannel(name: InAppBrowserWebViewController.METHOD_CHANNEL_NAME_PREFIX + id, binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger()) let channel = FlutterMethodChannel(name: InAppBrowserWebViewController.METHOD_CHANNEL_NAME_PREFIX + id, binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger())
@ -363,6 +364,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega
public func show(completion: (() -> Void)? = nil) { public func show(completion: (() -> Void)? = nil) {
if let navController = navigationController as? InAppBrowserNavigationController, let window = navController.tmpWindow { if let navController = navigationController as? InAppBrowserNavigationController, let window = navController.tmpWindow {
isHidden = false
window.alpha = 0.0 window.alpha = 0.0
window.isHidden = false window.isHidden = false
window.makeKeyAndVisible() window.makeKeyAndVisible()
@ -375,6 +377,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega
public func hide(completion: (() -> Void)? = nil) { public func hide(completion: (() -> Void)? = nil) {
if let navController = navigationController as? InAppBrowserNavigationController, let window = navController.tmpWindow { if let navController = navigationController as? InAppBrowserNavigationController, let window = navController.tmpWindow {
isHidden = true
window.alpha = 1.0 window.alpha = 1.0
UIView.animate(withDuration: 0.2) { UIView.animate(withDuration: 0.2) {
window.alpha = 0.0 window.alpha = 0.0

View File

@ -1562,8 +1562,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
} }
@available(iOS 15.0, *) @available(iOS 15.0, *)
@available(macOS 12.0, *)
@available(macCatalyst 15.0, *)
public func webView(_ webView: WKWebView, public func webView(_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin, requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo, initiatedByFrame frame: WKFrameInfo,
@ -1605,8 +1603,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
} }
@available(iOS 15.0, *) @available(iOS 15.0, *)
@available(macOS 12.0, *)
@available(macCatalyst 15.0, *)
public func webView(_ webView: WKWebView, public func webView(_ webView: WKWebView,
requestDeviceOrientationAndMotionPermissionFor origin: WKSecurityOrigin, requestDeviceOrientationAndMotionPermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo, initiatedByFrame frame: WKFrameInfo,
@ -2848,6 +2844,10 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
return Int64(scrollView.contentSize.height) return Int64(scrollView.contentSize.height)
} }
public func getContentWidth() -> Int64 {
return Int64(scrollView.contentSize.width)
}
public func zoomBy(zoomFactor: Float, animated: Bool) { public func zoomBy(zoomFactor: Float, animated: Bool) {
let currentZoomScale = scrollView.zoomScale let currentZoomScale = scrollView.zoomScale
scrollView.setZoomScale(currentZoomScale * CGFloat(zoomFactor), animated: animated) scrollView.setZoomScale(currentZoomScale * CGFloat(zoomFactor), animated: animated)

View File

@ -119,7 +119,7 @@ public class InAppWebViewSettings: ISettings<InAppWebView> {
} else { } else {
realSettings["mediaPlaybackRequiresUserGesture"] = configuration.mediaPlaybackRequiresUserAction realSettings["mediaPlaybackRequiresUserGesture"] = configuration.mediaPlaybackRequiresUserAction
} }
realSettings["minimumFontSize"] = configuration.preferences.minimumFontSize realSettings["minimumFontSize"] = Int(configuration.preferences.minimumFontSize)
realSettings["suppressesIncrementalRendering"] = configuration.suppressesIncrementalRendering realSettings["suppressesIncrementalRendering"] = configuration.suppressesIncrementalRendering
realSettings["allowsBackForwardNavigationGestures"] = webView.allowsBackForwardNavigationGestures realSettings["allowsBackForwardNavigationGestures"] = webView.allowsBackForwardNavigationGestures
realSettings["allowsInlineMediaPlayback"] = configuration.allowsInlineMediaPlayback realSettings["allowsInlineMediaPlayback"] = configuration.allowsInlineMediaPlayback

View File

@ -206,6 +206,13 @@ public class WebViewChannelDelegate : ChannelDelegate {
result(FlutterMethodNotImplemented) result(FlutterMethodNotImplemented)
} }
break break
case .isHidden:
if let iabController = webView?.inAppBrowserDelegate as? InAppBrowserWebViewController {
result(iabController.isHidden)
} else {
result(FlutterMethodNotImplemented)
}
break
case .getCopyBackForwardList: case .getCopyBackForwardList:
result(webView?.getCopyBackForwardList()) result(webView?.getCopyBackForwardList())
break break
@ -290,6 +297,9 @@ public class WebViewChannelDelegate : ChannelDelegate {
case .getContentHeight: case .getContentHeight:
result(webView?.getContentHeight()) result(webView?.getContentHeight())
break break
case .getContentWidth:
result(webView?.getContentWidth())
break
case .zoomBy: case .zoomBy:
let zoomFactor = (arguments!["zoomFactor"] as! NSNumber).floatValue let zoomFactor = (arguments!["zoomFactor"] as! NSNumber).floatValue
let animated = arguments!["animated"] as! Bool let animated = arguments!["animated"] as! Bool
@ -572,8 +582,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
if let webView = self.webView, #available(iOS 14.5, *) { if let webView = self.webView, #available(iOS 14.5, *) {
// closeAllMediaPresentations with completionHandler v15.0 makes the app crash // closeAllMediaPresentations with completionHandler v15.0 makes the app crash
// with error EXC_BAD_ACCESS, so use closeAllMediaPresentations v14.5 // with error EXC_BAD_ACCESS, so use closeAllMediaPresentations v14.5
if #available(iOS 16.0, *) {
webView.closeAllMediaPresentations {
result(true)
}
} else {
webView.closeAllMediaPresentations() webView.closeAllMediaPresentations()
result(true) result(true)
}
} else { } else {
result(false) result(false)
} }

View File

@ -34,6 +34,7 @@ public enum WebViewChannelDelegateMethods: String {
case close = "close" case close = "close"
case show = "show" case show = "show"
case hide = "hide" case hide = "hide"
case isHidden = "isHidden"
case getCopyBackForwardList = "getCopyBackForwardList" case getCopyBackForwardList = "getCopyBackForwardList"
@available(*, deprecated, message: "Use FindInteractionController.findAll instead.") @available(*, deprecated, message: "Use FindInteractionController.findAll instead.")
case findAll = "findAll" case findAll = "findAll"
@ -48,6 +49,7 @@ public enum WebViewChannelDelegateMethods: String {
case resumeTimers = "resumeTimers" case resumeTimers = "resumeTimers"
case printCurrentPage = "printCurrentPage" case printCurrentPage = "printCurrentPage"
case getContentHeight = "getContentHeight" case getContentHeight = "getContentHeight"
case getContentWidth = "getContentWidth"
case zoomBy = "zoomBy" case zoomBy = "zoomBy"
case reloadFromOrigin = "reloadFromOrigin" case reloadFromOrigin = "reloadFromOrigin"
case getOriginalUrl = "getOriginalUrl" case getOriginalUrl = "getOriginalUrl"

View File

@ -2,7 +2,7 @@ import 'types/main.dart';
///Class that represents a set of rules to use block content in the browser window. ///Class that represents a set of rules to use block content in the browser window.
/// ///
///On iOS, it uses [WKContentRuleListStore](https://developer.apple.com/documentation/webkit/wkcontentruleliststore). ///On iOS and MacOS, it uses [WKContentRuleListStore](https://developer.apple.com/documentation/webkit/wkcontentruleliststore).
///On Android, it uses a custom implementation because such functionality doesn't exist. ///On Android, it uses a custom implementation because such functionality doesn't exist.
/// ///
///In general, this [article](https://developer.apple.com/documentation/safariservices/creating_a_content_blocker) can be used to get an overview about this functionality ///In general, this [article](https://developer.apple.com/documentation/safariservices/creating_a_content_blocker) can be used to get an overview about this functionality
@ -27,6 +27,11 @@ class ContentBlocker {
action: ContentBlockerAction.fromMap( action: ContentBlockerAction.fromMap(
Map<String, dynamic>.from(map["action"]!))); Map<String, dynamic>.from(map["action"]!)));
} }
@override
String toString() {
return 'ContentBlocker{trigger: $trigger, action: $action}';
}
} }
///Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action. ///Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action.
@ -39,40 +44,76 @@ class ContentBlockerTrigger {
///A list of regular expressions to match iframes URL against. ///A list of regular expressions to match iframes URL against.
/// ///
///*NOTE*: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
List<String> ifFrameUrl; List<String> ifFrameUrl;
///A Boolean value. The default value is `false`. ///A Boolean value. The default value is `false`.
/// ///
///*NOTE*: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool urlFilterIsCaseSensitive; bool urlFilterIsCaseSensitive;
///A list of [ContentBlockerTriggerResourceType] representing the resource types (how the browser intends to use the resource) that the rule should match. ///A list of [ContentBlockerTriggerResourceType] representing the resource types (how the browser intends to use the resource) that the rule should match.
///If not specified, the rule matches all resource types. ///If not specified, the rule matches all resource types.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<ContentBlockerTriggerResourceType> resourceType; List<ContentBlockerTriggerResourceType> resourceType;
///A list of strings matched to a URL's domain; limits action to a list of specific domains. ///A list of strings matched to a URL's domain; limits action to a list of specific domains.
///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.unlessDomain]. ///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.unlessDomain].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<String> ifDomain; List<String> ifDomain;
///A list of strings matched to a URL's domain; acts on any site except domains in a provided list. ///A list of strings matched to a URL's domain; acts on any site except domains in a provided list.
///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.ifDomain]. ///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.ifDomain].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<String> unlessDomain; List<String> unlessDomain;
///A list of [ContentBlockerTriggerLoadType] that can include one of two mutually exclusive values. If not specified, the rule matches all load types. ///A list of [ContentBlockerTriggerLoadType] that can include one of two mutually exclusive values. If not specified, the rule matches all load types.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<ContentBlockerTriggerLoadType> loadType; List<ContentBlockerTriggerLoadType> loadType;
///A list of strings matched to the entire main document URL; limits the action to a specific list of URL patterns. ///A list of strings matched to the entire main document URL; limits the action to a specific list of URL patterns.
///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.unlessTopUrl]. ///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.unlessTopUrl].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<String> ifTopUrl; List<String> ifTopUrl;
///An array of strings matched to the entire main document URL; acts on any site except URL patterns in provided list. ///An array of strings matched to the entire main document URL; acts on any site except URL patterns in provided list.
///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.ifTopUrl]. ///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.ifTopUrl].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
List<String> unlessTopUrl; List<String> unlessTopUrl;
///An array of strings that specify loading contexts. ///An array of strings that specify loading contexts.
/// ///
///*NOTE*: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
List<ContentBlockerTriggerLoadContext> loadContext; List<ContentBlockerTriggerLoadContext> loadContext;
ContentBlockerTrigger( ContentBlockerTrigger(
@ -161,7 +202,7 @@ class ContentBlockerTrigger {
return ContentBlockerTrigger( return ContentBlockerTrigger(
urlFilter: map["url-filter"], urlFilter: map["url-filter"],
ifFrameUrl: map["if-frame-url"], ifFrameUrl: List<String>.from(map["if-frame-url"] ?? []),
urlFilterIsCaseSensitive: map["url-filter-is-case-sensitive"], urlFilterIsCaseSensitive: map["url-filter-is-case-sensitive"],
ifDomain: List<String>.from(map["if-domain"] ?? []), ifDomain: List<String>.from(map["if-domain"] ?? []),
unlessDomain: List<String>.from(map["unless-domain"] ?? []), unlessDomain: List<String>.from(map["unless-domain"] ?? []),
@ -171,6 +212,11 @@ class ContentBlockerTrigger {
unlessTopUrl: List<String>.from(map["unless-top-url"] ?? []), unlessTopUrl: List<String>.from(map["unless-top-url"] ?? []),
loadContext: loadContext); loadContext: loadContext);
} }
@override
String toString() {
return 'ContentBlockerTrigger{urlFilter: $urlFilter, ifFrameUrl: $ifFrameUrl, urlFilterIsCaseSensitive: $urlFilterIsCaseSensitive, resourceType: $resourceType, ifDomain: $ifDomain, unlessDomain: $unlessDomain, loadType: $loadType, ifTopUrl: $ifTopUrl, unlessTopUrl: $unlessTopUrl, loadContext: $loadContext}';
}
} }
///Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched. ///Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched.
@ -213,4 +259,9 @@ class ContentBlockerAction {
type: ContentBlockerActionType.fromNativeValue(map["type"])!, type: ContentBlockerActionType.fromNativeValue(map["type"])!,
selector: map["selector"]); selector: map["selector"]);
} }
@override
String toString() {
return 'ContentBlockerAction{type: $type, selector: $selector}';
}
} }

View File

@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'in_app_webview/in_app_webview_controller.dart'; import 'in_app_webview/in_app_webview_controller.dart';
import 'in_app_webview/in_app_webview_settings.dart';
import 'in_app_webview/headless_in_app_webview.dart'; import 'in_app_webview/headless_in_app_webview.dart';
import 'platform_util.dart'; import 'platform_util.dart';
@ -21,13 +20,13 @@ import 'types/main.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
class CookieManager { class CookieManager {
static CookieManager? _instance; static CookieManager? _instance;
static const MethodChannel _channel = const MethodChannel( static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_cookiemanager'); 'com.pichillilorenzo/flutter_inappwebview_cookiemanager');
///Contains only iOS-specific methods of [CookieManager].
///Use [CookieManager] instead. ///Use [CookieManager] instead.
@Deprecated("Use CookieManager instead") @Deprecated("Use CookieManager instead")
late IOSCookieManager ios; late IOSCookieManager ios;
@ -60,9 +59,9 @@ class CookieManager {
///The default value of [path] is `"/"`. ///The default value of [path] is `"/"`.
/// ///
///[webViewController] could be used if you need to set a session-only cookie using JavaScript (so [isHttpOnly] cannot be set, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) ///[webViewController] could be used if you need to set a session-only cookie using JavaScript (so [isHttpOnly] cannot be set, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
///on the current URL of the [WebView] managed by that controller when you need to target iOS below 11 and Web platform. In this case the [url] parameter is ignored. ///on the current URL of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. In this case the [url] parameter is ignored.
/// ///
///**NOTE for iOS below 11.0**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView] ///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to set the cookie (session-only cookie won't work! In that case, you should set also [expiresDate] or [maxAge]). ///to set the cookie (session-only cookie won't work! In that case, you should set also [expiresDate] or [maxAge]).
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
@ -72,6 +71,7 @@ class CookieManager {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - CookieManager.setCookie](https://developer.android.com/reference/android/webkit/CookieManager#setCookie(java.lang.String,%20java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) ///- Android native WebView ([Official API - CookieManager.setCookie](https://developer.android.com/reference/android/webkit/CookieManager#setCookie(java.lang.String,%20java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E)))
///- iOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie)) ///- iOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie))
///- MacOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie))
///- Web ///- Web
Future<void> setCookie( Future<void> setCookie(
{required Uri url, {required Uri url,
@ -94,14 +94,7 @@ class CookieManager {
assert(value.isNotEmpty); assert(value.isNotEmpty);
assert(path.isNotEmpty); assert(path.isNotEmpty);
if (defaultTargetPlatform == TargetPlatform.iOS || kIsWeb) { if (await _shouldUseJavascript()) {
var shouldUseJavascript = kIsWeb;
if (defaultTargetPlatform == TargetPlatform.iOS && !kIsWeb) {
var platformUtil = PlatformUtil.instance();
var version = double.tryParse(await platformUtil.getSystemVersion());
shouldUseJavascript = version != null && version < 11.0;
}
if (shouldUseJavascript) {
await _setCookieWithJavaScript( await _setCookieWithJavaScript(
url: url, url: url,
name: name, name: name,
@ -115,7 +108,6 @@ class CookieManager {
webViewController: webViewController); webViewController: webViewController);
return; return;
} }
}
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('url', () => url.toString());
@ -160,16 +152,17 @@ class CookieManager {
cookieValue += ";"; cookieValue += ";";
if (webViewController != null) { if (webViewController != null) {
InAppWebViewSettings? settings = await webViewController.getSettings(); final javaScriptEnabled =
if (settings != null && settings.javaScriptEnabled) { (await webViewController.getSettings())?.javaScriptEnabled ?? false;
if (javaScriptEnabled) {
await webViewController.evaluateJavascript( await webViewController.evaluateJavascript(
source: 'document.cookie="$cookieValue"'); source: 'document.cookie="$cookieValue"');
return; return;
} }
} }
var setCookieCompleter = Completer<void>(); final setCookieCompleter = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( final headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: url), initialUrlRequest: URLRequest(url: url),
onLoadStop: (controller, url) async { onLoadStop: (controller, url) async {
await controller.evaluateJavascript( await controller.evaluateJavascript(
@ -185,10 +178,10 @@ class CookieManager {
///Gets all the cookies for the given [url]. ///Gets all the cookies for the given [url].
/// ///
///[webViewController] is used for getting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) ///[webViewController] is used for getting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
///from the current context of the [WebView] managed by that controller when you need to target iOS below 11 and Web platform. JavaScript must be enabled in order to work. ///from the current context of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work.
///In this case the [url] parameter is ignored. ///In this case the [url] parameter is ignored.
/// ///
///**NOTE for iOS below 11.0**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value]. ///**NOTE for iOS below 11.0 and MacOS below 10.13**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value].
///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView] ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!). ///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!).
/// ///
@ -199,6 +192,7 @@ class CookieManager {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - CookieManager.getCookie](https://developer.android.com/reference/android/webkit/CookieManager#getCookie(java.lang.String))) ///- Android native WebView ([Official API - CookieManager.getCookie](https://developer.android.com/reference/android/webkit/CookieManager#getCookie(java.lang.String)))
///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) ///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies))
///- MacOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies))
///- Web ///- Web
Future<List<Cookie>> getCookies( Future<List<Cookie>> getCookies(
{required Uri url, {required Uri url,
@ -209,18 +203,10 @@ class CookieManager {
webViewController = webViewController ?? iosBelow11WebViewController; webViewController = webViewController ?? iosBelow11WebViewController;
if (defaultTargetPlatform == TargetPlatform.iOS || kIsWeb) { if (await _shouldUseJavascript()) {
var shouldUseJavascript = kIsWeb;
if (defaultTargetPlatform == TargetPlatform.iOS && !kIsWeb) {
var platformUtil = PlatformUtil.instance();
var version = double.tryParse(await platformUtil.getSystemVersion());
shouldUseJavascript = version != null && version < 11.0;
}
if (shouldUseJavascript) {
return await _getCookiesWithJavaScript( return await _getCookiesWithJavaScript(
url: url, webViewController: webViewController); url: url, webViewController: webViewController);
} }
}
List<Cookie> cookies = []; List<Cookie> cookies = [];
@ -253,8 +239,9 @@ class CookieManager {
List<Cookie> cookies = []; List<Cookie> cookies = [];
if (webViewController != null) { if (webViewController != null) {
InAppWebViewSettings? settings = await webViewController.getSettings(); final javaScriptEnabled =
if (settings != null && settings.javaScriptEnabled) { (await webViewController.getSettings())?.javaScriptEnabled ?? false;
if (javaScriptEnabled) {
List<String> documentCookies = (await webViewController List<String> documentCookies = (await webViewController
.evaluateJavascript(source: 'document.cookie') as String) .evaluateJavascript(source: 'document.cookie') as String)
.split(';') .split(';')
@ -273,8 +260,8 @@ class CookieManager {
} }
} }
var pageLoaded = Completer<void>(); final pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( final headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: url), initialUrlRequest: URLRequest(url: url),
onLoadStop: (controller, url) async { onLoadStop: (controller, url) async {
pageLoaded.complete(); pageLoaded.complete();
@ -304,10 +291,10 @@ class CookieManager {
///Gets a cookie by its [name] for the given [url]. ///Gets a cookie by its [name] for the given [url].
/// ///
///[webViewController] is used for getting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) ///[webViewController] is used for getting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
///from the current context of the [WebView] managed by that controller when you need to target iOS below 11 and Web platform. JavaScript must be enabled in order to work. ///from the current context of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work.
///In this case the [url] parameter is ignored. ///In this case the [url] parameter is ignored.
/// ///
///**NOTE for iOS below 11.0**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value]. ///**NOTE for iOS below 11.0 and MacOS below 10.13**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value].
///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView] ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!). ///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!).
/// ///
@ -318,6 +305,7 @@ class CookieManager {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<Cookie?> getCookie( Future<Cookie?> getCookie(
{required Uri url, {required Uri url,
@ -330,21 +318,13 @@ class CookieManager {
webViewController = webViewController ?? iosBelow11WebViewController; webViewController = webViewController ?? iosBelow11WebViewController;
if (defaultTargetPlatform == TargetPlatform.iOS || kIsWeb) { if (await _shouldUseJavascript()) {
var shouldUseJavascript = kIsWeb;
if (defaultTargetPlatform == TargetPlatform.iOS && !kIsWeb) {
var platformUtil = PlatformUtil.instance();
var version = double.tryParse(await platformUtil.getSystemVersion());
shouldUseJavascript = version != null && version < 11.0;
}
if (shouldUseJavascript) {
List<Cookie> cookies = await _getCookiesWithJavaScript( List<Cookie> cookies = await _getCookiesWithJavaScript(
url: url, webViewController: webViewController); url: url, webViewController: webViewController);
return cookies return cookies
.cast<Cookie?>() .cast<Cookie?>()
.firstWhere((cookie) => cookie!.name == name, orElse: () => null); .firstWhere((cookie) => cookie!.name == name, orElse: () => null);
} }
}
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('url', () => url.toString());
@ -373,10 +353,10 @@ class CookieManager {
///The default value of [path] is `"/"`. ///The default value of [path] is `"/"`.
/// ///
///[webViewController] is used for deleting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) ///[webViewController] is used for deleting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
///from the current context of the [WebView] managed by that controller when you need to target iOS below 11 and Web platform. JavaScript must be enabled in order to work. ///from the current context of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work.
///In this case the [url] parameter is ignored. ///In this case the [url] parameter is ignored.
/// ///
///**NOTE for iOS below 11.0**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView] ///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to delete the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be deleted!). ///to delete the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be deleted!).
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
@ -386,6 +366,7 @@ class CookieManager {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete) ///- iOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete)
///- MacOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete)
///- Web ///- Web
Future<void> deleteCookie( Future<void> deleteCookie(
{required Uri url, {required Uri url,
@ -400,14 +381,7 @@ class CookieManager {
webViewController = webViewController ?? iosBelow11WebViewController; webViewController = webViewController ?? iosBelow11WebViewController;
if (defaultTargetPlatform == TargetPlatform.iOS || kIsWeb) { if (await _shouldUseJavascript()) {
var shouldUseJavascript = kIsWeb;
if (defaultTargetPlatform == TargetPlatform.iOS && !kIsWeb) {
var platformUtil = PlatformUtil.instance();
var version = double.tryParse(await platformUtil.getSystemVersion());
shouldUseJavascript = version != null && version < 11.0;
}
if (shouldUseJavascript) {
await _setCookieWithJavaScript( await _setCookieWithJavaScript(
url: url, url: url,
name: name, name: name,
@ -418,7 +392,6 @@ class CookieManager {
webViewController: webViewController); webViewController: webViewController);
return; return;
} }
}
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('url', () => url.toString());
@ -433,10 +406,10 @@ class CookieManager {
///The default value of [path] is `"/"`. ///The default value of [path] is `"/"`.
/// ///
///[webViewController] is used for deleting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) ///[webViewController] is used for deleting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
///from the current context of the [WebView] managed by that controller when you need to target iOS below 11 and Web platform. JavaScript must be enabled in order to work. ///from the current context of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work.
///In this case the [url] parameter is ignored. ///In this case the [url] parameter is ignored.
/// ///
///**NOTE for iOS below 11.0**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView] ///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!). ///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!).
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
@ -446,6 +419,7 @@ class CookieManager {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> deleteCookies( Future<void> deleteCookies(
{required Uri url, {required Uri url,
@ -458,14 +432,7 @@ class CookieManager {
webViewController = webViewController ?? iosBelow11WebViewController; webViewController = webViewController ?? iosBelow11WebViewController;
if (defaultTargetPlatform == TargetPlatform.iOS || kIsWeb) { if (await _shouldUseJavascript()) {
var shouldUseJavascript = kIsWeb;
if (defaultTargetPlatform == TargetPlatform.iOS && !kIsWeb) {
var platformUtil = PlatformUtil.instance();
var version = double.tryParse(await platformUtil.getSystemVersion());
shouldUseJavascript = version != null && version < 11.0;
}
if (shouldUseJavascript) {
List<Cookie> cookies = await _getCookiesWithJavaScript( List<Cookie> cookies = await _getCookiesWithJavaScript(
url: url, webViewController: webViewController); url: url, webViewController: webViewController);
for (var i = 0; i < cookies.length; i++) { for (var i = 0; i < cookies.length; i++) {
@ -480,7 +447,6 @@ class CookieManager {
} }
return; return;
} }
}
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('url', () => url.toString());
@ -493,9 +459,12 @@ class CookieManager {
/// ///
///**NOTE for iOS**: available from iOS 11.0+. ///**NOTE for iOS**: available from iOS 11.0+.
/// ///
///**NOTE for MacOS**: available from iOS 10.13+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - CookieManager.removeAllCookies](https://developer.android.com/reference/android/webkit/CookieManager#removeAllCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) ///- Android native WebView ([Official API - CookieManager.removeAllCookies](https://developer.android.com/reference/android/webkit/CookieManager#removeAllCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E)))
///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata)) ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata))
///- MacOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata))
Future<void> deleteAllCookies() async { Future<void> deleteAllCookies() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('deleteAllCookies', args); await _channel.invokeMethod('deleteAllCookies', args);
@ -503,10 +472,13 @@ class CookieManager {
///Fetches all stored cookies. ///Fetches all stored cookies.
/// ///
///**NOTE**: available on iOS 11.0+. ///**NOTE for iOS**: available on iOS 11.0+.
///
///**NOTE for MacOS**: available from iOS 10.13+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) ///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies))
///- MacOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies))
Future<List<Cookie>> getAllCookies() async { Future<List<Cookie>> getAllCookies() async {
List<Cookie> cookies = []; List<Cookie> cookies = [];
@ -542,6 +514,21 @@ class CookieManager {
timezone: 'GMT') timezone: 'GMT')
: await platformUtil.getWebCookieExpirationDate(date: dateTime); : await platformUtil.getWebCookieExpirationDate(date: dateTime);
} }
Future<bool> _shouldUseJavascript() async {
if (kIsWeb) {
return true;
}
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
final platformUtil = PlatformUtil.instance();
final systemVersion = await platformUtil.getSystemVersion();
return defaultTargetPlatform == TargetPlatform.iOS
? systemVersion.compareTo("11") == -1
: systemVersion.compareTo("10.13") == -1;
}
return false;
}
} }
///Class that contains only iOS-specific methods of [CookieManager]. ///Class that contains only iOS-specific methods of [CookieManager].

View File

@ -9,6 +9,7 @@ import '../types/main.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
class FindInteractionController { class FindInteractionController {
MethodChannel? _channel; MethodChannel? _channel;
@ -29,6 +30,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.FindListener.onFindResultReceived](https://developer.android.com/reference/android/webkit/WebView.FindListener#onFindResultReceived(int,%20int,%20boolean))) ///- Android native WebView ([Official API - WebView.FindListener.onFindResultReceived](https://developer.android.com/reference/android/webkit/WebView.FindListener#onFindResultReceived(int,%20int,%20boolean)))
///- iOS ///- iOS
///- MacOS
final void Function( final void Function(
FindInteractionController controller, FindInteractionController controller,
int activeMatchOrdinal, int activeMatchOrdinal,
@ -108,6 +110,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.findAllAsync](https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String))) ///- Android native WebView ([Official API - WebView.findAllAsync](https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String)))
///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2) with [Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2) with [Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2))
///- MacOS
Future<void> findAll({String? find}) async { Future<void> findAll({String? find}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('find', () => find); args.putIfAbsent('find', () => find);
@ -125,6 +128,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.findNext](https://developer.android.com/reference/android/webkit/WebView#findNext(boolean))) ///- Android native WebView ([Official API - WebView.findNext](https://developer.android.com/reference/android/webkit/WebView#findNext(boolean)))
///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.findNext](https://developer.apple.com/documentation/uikit/uifindinteraction/3975829-findnext?changes=_2) and ([Official API - UIFindInteraction.findPrevious](https://developer.apple.com/documentation/uikit/uifindinteraction/3975830-findprevious?changes=_2))) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.findNext](https://developer.apple.com/documentation/uikit/uifindinteraction/3975829-findnext?changes=_2) and ([Official API - UIFindInteraction.findPrevious](https://developer.apple.com/documentation/uikit/uifindinteraction/3975830-findprevious?changes=_2)))
///- MacOS
Future<void> findNext({bool forward = true}) async { Future<void> findNext({bool forward = true}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('forward', () => forward); args.putIfAbsent('forward', () => forward);
@ -140,6 +144,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.clearMatches](https://developer.android.com/reference/android/webkit/WebView#clearMatches())) ///- Android native WebView ([Official API - WebView.clearMatches](https://developer.android.com/reference/android/webkit/WebView#clearMatches()))
///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2)) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2))
///- MacOS
Future<void> clearMatches() async { Future<void> clearMatches() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel?.invokeMethod('clearMatches', args); await _channel?.invokeMethod('clearMatches', args);
@ -153,6 +158,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2))
///- MacOS
Future<void> setSearchText(String? searchText) async { Future<void> setSearchText(String? searchText) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('searchText', () => searchText); args.putIfAbsent('searchText', () => searchText);
@ -167,6 +173,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2))
///- MacOS
Future<String?> getSearchText() async { Future<String?> getSearchText() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel?.invokeMethod('getSearchText', args); return await _channel?.invokeMethod('getSearchText', args);
@ -221,6 +228,7 @@ class FindInteractionController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - UIFindInteraction.activeFindSession](https://developer.apple.com/documentation/uikit/uifindinteraction/3975825-activefindsession?changes=_7____4_8&language=objc)) ///- iOS ([Official API - UIFindInteraction.activeFindSession](https://developer.apple.com/documentation/uikit/uifindinteraction/3975825-activefindsession?changes=_7____4_8&language=objc))
///- MacOS
Future<FindSession?> getActiveFindSession() async { Future<FindSession?> getActiveFindSession() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? result = Map<String, dynamic>? result =

View File

@ -4,7 +4,7 @@ import 'types/main.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
///Class that implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache. ///Class that implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache.
///On iOS, this class uses the [URLCredentialStorage](https://developer.apple.com/documentation/foundation/urlcredentialstorage) class. ///On iOS and MacOS, this class uses the [URLCredentialStorage](https://developer.apple.com/documentation/foundation/urlcredentialstorage) class.
///On Android, this class has a custom implementation using `android.database.sqlite.SQLiteDatabase` because ///On Android, this class has a custom implementation using `android.database.sqlite.SQLiteDatabase` because
///[WebViewDatabase](https://developer.android.com/reference/android/webkit/WebViewDatabase) ///[WebViewDatabase](https://developer.android.com/reference/android/webkit/WebViewDatabase)
///doesn't offer the same functionalities as iOS `URLCredentialStorage`. ///doesn't offer the same functionalities as iOS `URLCredentialStorage`.
@ -12,6 +12,7 @@ import 'package:flutter/services.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
class HttpAuthCredentialDatabase { class HttpAuthCredentialDatabase {
static HttpAuthCredentialDatabase? _instance; static HttpAuthCredentialDatabase? _instance;
static const MethodChannel _channel = const MethodChannel( static const MethodChannel _channel = const MethodChannel(
@ -44,6 +45,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - URLCredentialStorage.allCredentials](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1413859-allcredentials)) ///- iOS ([Official API - URLCredentialStorage.allCredentials](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1413859-allcredentials))
///- MacOS ([Official API - URLCredentialStorage.allCredentials](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1413859-allcredentials))
Future<List<URLProtectionSpaceHttpAuthCredentials>> Future<List<URLProtectionSpaceHttpAuthCredentials>>
getAllAuthCredentials() async { getAllAuthCredentials() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -67,6 +69,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<List<URLCredential>> getHttpAuthCredentials( Future<List<URLCredential>> getHttpAuthCredentials(
{required URLProtectionSpace protectionSpace}) async { {required URLProtectionSpace protectionSpace}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -91,6 +94,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - URLCredentialStorage.set](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1407227-set)) ///- iOS ([Official API - URLCredentialStorage.set](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1407227-set))
///- MacOS ([Official API - URLCredentialStorage.set](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1407227-set))
Future<void> setHttpAuthCredential( Future<void> setHttpAuthCredential(
{required URLProtectionSpace protectionSpace, {required URLProtectionSpace protectionSpace,
required URLCredential credential}) async { required URLCredential credential}) async {
@ -109,6 +113,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - URLCredentialStorage.remove](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1408664-remove)) ///- iOS ([Official API - URLCredentialStorage.remove](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1408664-remove))
///- MacOS ([Official API - URLCredentialStorage.remove](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1408664-remove))
Future<void> removeHttpAuthCredential( Future<void> removeHttpAuthCredential(
{required URLProtectionSpace protectionSpace, {required URLProtectionSpace protectionSpace,
required URLCredential credential}) async { required URLCredential credential}) async {
@ -127,6 +132,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> removeHttpAuthCredentials( Future<void> removeHttpAuthCredentials(
{required URLProtectionSpace protectionSpace}) async { {required URLProtectionSpace protectionSpace}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -142,6 +148,7 @@ class HttpAuthCredentialDatabase {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> clearAllAuthCredentials() async { Future<void> clearAllAuthCredentials() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('clearAllAuthCredentials', args); await _channel.invokeMethod('clearAllAuthCredentials', args);

View File

@ -48,6 +48,7 @@ class InAppBrowserNotOpenedException implements Exception {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
class InAppBrowser { class InAppBrowser {
///Debug settings. ///Debug settings.
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(); static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
@ -152,6 +153,11 @@ class InAppBrowser {
///[options]: Options for the [InAppBrowser]. ///[options]: Options for the [InAppBrowser].
/// ///
///[settings]: Settings for the [InAppBrowser]. ///[settings]: Settings for the [InAppBrowser].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> openUrlRequest( Future<void> openUrlRequest(
{required URLRequest urlRequest, {required URLRequest urlRequest,
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
@ -220,6 +226,11 @@ class InAppBrowser {
///[options]: Options for the [InAppBrowser]. ///[options]: Options for the [InAppBrowser].
/// ///
///[settings]: Settings for the [InAppBrowser]. ///[settings]: Settings for the [InAppBrowser].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> openFile( Future<void> openFile(
{required String assetFilePath, {required String assetFilePath,
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
@ -262,6 +273,11 @@ class InAppBrowser {
///The [options] parameter specifies the options for the [InAppBrowser]. ///The [options] parameter specifies the options for the [InAppBrowser].
/// ///
///[settings]: Settings for the [InAppBrowser]. ///[settings]: Settings for the [InAppBrowser].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> openData( Future<void> openData(
{required String data, {required String data,
String mimeType = "text/html", String mimeType = "text/html",
@ -303,6 +319,11 @@ class InAppBrowser {
} }
///This is a static method that opens an [url] in the system browser. You wont be able to use the [InAppBrowser] methods here! ///This is a static method that opens an [url] in the system browser. You wont be able to use the [InAppBrowser] methods here!
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
static Future<void> openWithSystemBrowser({required Uri url}) async { static Future<void> openWithSystemBrowser({required Uri url}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -311,6 +332,11 @@ class InAppBrowser {
} }
///Displays an [InAppBrowser] window that was opened hidden. Calling this has no effect if the [InAppBrowser] was already visible. ///Displays an [InAppBrowser] window that was opened hidden. Calling this has no effect if the [InAppBrowser] was already visible.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> show() async { Future<void> show() async {
this.throwIfNotOpened(); this.throwIfNotOpened();
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -318,6 +344,11 @@ class InAppBrowser {
} }
///Hides the [InAppBrowser] window. Calling this has no effect if the [InAppBrowser] was already hidden. ///Hides the [InAppBrowser] window. Calling this has no effect if the [InAppBrowser] was already hidden.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> hide() async { Future<void> hide() async {
this.throwIfNotOpened(); this.throwIfNotOpened();
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -325,6 +356,11 @@ class InAppBrowser {
} }
///Closes the [InAppBrowser] window. ///Closes the [InAppBrowser] window.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> close() async { Future<void> close() async {
this.throwIfNotOpened(); this.throwIfNotOpened();
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -332,6 +368,11 @@ class InAppBrowser {
} }
///Check if the Web View of the [InAppBrowser] instance is hidden. ///Check if the Web View of the [InAppBrowser] instance is hidden.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<bool> isHidden() async { Future<bool> isHidden() async {
this.throwIfNotOpened(); this.throwIfNotOpened();
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -365,6 +406,11 @@ class InAppBrowser {
} }
///Sets the [InAppBrowser] settings with the new [settings] and evaluates them. ///Sets the [InAppBrowser] settings with the new [settings] and evaluates them.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<void> setSettings( Future<void> setSettings(
{required InAppBrowserClassSettings settings}) async { {required InAppBrowserClassSettings settings}) async {
this.throwIfNotOpened(); this.throwIfNotOpened();
@ -375,6 +421,11 @@ class InAppBrowser {
} }
///Gets the current [InAppBrowser] settings. Returns `null` if it wasn't able to get them. ///Gets the current [InAppBrowser] settings. Returns `null` if it wasn't able to get them.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Future<InAppBrowserClassSettings?> getSettings() async { Future<InAppBrowserClassSettings?> getSettings() async {
this.throwIfNotOpened(); this.throwIfNotOpened();
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -391,14 +442,29 @@ class InAppBrowser {
} }
///Returns `true` if the [InAppBrowser] instance is opened, otherwise `false`. ///Returns `true` if the [InAppBrowser] instance is opened, otherwise `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool isOpened() { bool isOpened() {
return this._isOpened; return this._isOpened;
} }
///Event fired when the [InAppBrowser] is created. ///Event fired when the [InAppBrowser] is created.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
void onBrowserCreated() {} void onBrowserCreated() {}
///Event fired when the [InAppBrowser] window is closed. ///Event fired when the [InAppBrowser] window is closed.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
void onExit() {} void onExit() {}
///Event fired when the [InAppBrowser] starts to load an [url]. ///Event fired when the [InAppBrowser] starts to load an [url].
@ -406,6 +472,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap))) ///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
void onLoadStart(Uri? url) {} void onLoadStart(Uri? url) {}
///Event fired when the [InAppBrowser] finishes loading an [url]. ///Event fired when the [InAppBrowser] finishes loading an [url].
@ -413,6 +480,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
void onLoadStop(Uri? url) {} void onLoadStop(Uri? url) {}
///Use [onReceivedError] instead. ///Use [onReceivedError] instead.
@ -424,6 +492,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError))) ///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
void onReceivedError(WebResourceRequest request, WebResourceError error) {} void onReceivedError(WebResourceRequest request, WebResourceError error) {}
///Use [onReceivedHttpError] instead. ///Use [onReceivedHttpError] instead.
@ -441,6 +510,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse))) ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
void onReceivedHttpError( void onReceivedHttpError(
WebResourceRequest request, WebResourceResponse errorResponse) {} WebResourceRequest request, WebResourceResponse errorResponse) {}
@ -449,6 +519,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int))) ///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)))
///- iOS ///- iOS
///- MacOS
void onProgressChanged(int progress) {} void onProgressChanged(int progress) {}
///Event fired when the [InAppBrowser] webview receives a [ConsoleMessage]. ///Event fired when the [InAppBrowser] webview receives a [ConsoleMessage].
@ -456,23 +527,25 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage))) ///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)))
///- iOS ///- iOS
///- MacOS
void onConsoleMessage(ConsoleMessage consoleMessage) {} void onConsoleMessage(ConsoleMessage consoleMessage) {}
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView. ///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
/// ///
///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default. ///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default.
///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] option ///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] setting
///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled. ///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled.
/// ///
///Also, on Android, this method is not called for POST requests. ///Also, on Android, this method is not called for POST requests.
/// ///
///[navigationAction] represents an object that contains information about an action that causes navigation to occur. ///[navigationAction] represents an object that contains information about an action that causes navigation to occur.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
Future<NavigationActionPolicy?>? shouldOverrideUrlLoading( Future<NavigationActionPolicy?>? shouldOverrideUrlLoading(
NavigationAction navigationAction) { NavigationAction navigationAction) {
return null; return null;
@ -480,11 +553,12 @@ class InAppBrowser {
///Event fired when the [InAppBrowser] webview loads a resource. ///Event fired when the [InAppBrowser] webview loads a resource.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] options to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
void onLoadResource(LoadedResource resource) {} void onLoadResource(LoadedResource resource) {}
///Event fired when the [InAppBrowser] webview scrolls. ///Event fired when the [InAppBrowser] webview scrolls.
@ -493,9 +567,12 @@ class InAppBrowser {
/// ///
///[y] represents the current vertical scroll origin in pixels. ///[y] represents the current vertical scroll origin in pixels.
/// ///
///**NOTE for MacOS**: this method is implemented with using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int))) ///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)))
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll)) ///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll))
///- MacOS
void onScrollChanged(int x, int y) {} void onScrollChanged(int x, int y) {}
///Use [onDownloadStartRequest] instead ///Use [onDownloadStartRequest] instead
@ -507,11 +584,12 @@ class InAppBrowser {
/// ///
///[downloadStartRequest] represents the request of the file to download. ///[downloadStartRequest] represents the request of the file to download.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener))) ///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)))
///- iOS ///- iOS
///- MacOS
void onDownloadStartRequest(DownloadStartRequest downloadStartRequest) {} void onDownloadStartRequest(DownloadStartRequest downloadStartRequest) {}
///Use [onLoadResourceWithCustomScheme] instead. ///Use [onLoadResourceWithCustomScheme] instead.
@ -526,6 +604,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler)) ///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
Future<CustomSchemeResponse?>? onLoadResourceWithCustomScheme( Future<CustomSchemeResponse?>? onLoadResourceWithCustomScheme(
WebResourceRequest request) { WebResourceRequest request) {
return null; return null;
@ -539,11 +618,11 @@ class InAppBrowser {
/// ///
///[createWindowAction] represents the request. ///[createWindowAction] represents the request.
/// ///
///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically] option to `true`. ///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically] setting to `true`.
/// ///
///**NOTE**: on Android you need to set [InAppWebViewSettings.supportMultipleWindows] option to `true`. ///**NOTE**: on Android you need to set [InAppWebViewSettings.supportMultipleWindows] setting to `true`.
/// ///
///**NOTE**: on iOS, setting these initial options: [InAppWebViewSettings.supportZoom], [InAppWebViewSettings.useOnLoadResource], [InAppWebViewSettings.useShouldInterceptAjaxRequest], ///**NOTE**: on iOS and MacOS, setting these initial settings: [InAppWebViewSettings.supportZoom], [InAppWebViewSettings.useOnLoadResource], [InAppWebViewSettings.useShouldInterceptAjaxRequest],
///[InAppWebViewSettings.useShouldInterceptFetchRequest], [InAppWebViewSettings.applicationNameForUserAgent], [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically], ///[InAppWebViewSettings.useShouldInterceptFetchRequest], [InAppWebViewSettings.applicationNameForUserAgent], [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically],
///[InAppWebViewSettings.javaScriptEnabled], [InAppWebViewSettings.minimumFontSize], [InAppWebViewSettings.preferredContentMode], [InAppWebViewSettings.incognito], ///[InAppWebViewSettings.javaScriptEnabled], [InAppWebViewSettings.minimumFontSize], [InAppWebViewSettings.preferredContentMode], [InAppWebViewSettings.incognito],
///[InAppWebViewSettings.cacheEnabled], [InAppWebViewSettings.mediaPlaybackRequiresUserGesture], ///[InAppWebViewSettings.cacheEnabled], [InAppWebViewSettings.mediaPlaybackRequiresUserGesture],
@ -562,6 +641,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message))) ///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
Future<bool?>? onCreateWindow(CreateWindowAction createWindowAction) { Future<bool?>? onCreateWindow(CreateWindowAction createWindowAction) {
return null; return null;
} }
@ -572,6 +652,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView))) ///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)))
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) ///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
void onCloseWindow() {} void onCloseWindow() {}
///Event fired when the JavaScript `window` object of the WebView has received focus. ///Event fired when the JavaScript `window` object of the WebView has received focus.
@ -580,6 +661,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
void onWindowFocus() {} void onWindowFocus() {}
///Event fired when the JavaScript `window` object of the WebView has lost focus. ///Event fired when the JavaScript `window` object of the WebView has lost focus.
@ -588,6 +670,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
void onWindowBlur() {} void onWindowBlur() {}
///Event fired when javascript calls the `alert()` method to display an alert dialog. ///Event fired when javascript calls the `alert()` method to display an alert dialog.
@ -598,6 +681,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
Future<JsAlertResponse?>? onJsAlert(JsAlertRequest jsAlertRequest) { Future<JsAlertResponse?>? onJsAlert(JsAlertRequest jsAlertRequest) {
return null; return null;
} }
@ -610,6 +694,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
Future<JsConfirmResponse?>? onJsConfirm(JsConfirmRequest jsConfirmRequest) { Future<JsConfirmResponse?>? onJsConfirm(JsConfirmRequest jsConfirmRequest) {
return null; return null;
} }
@ -622,6 +707,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
Future<JsPromptResponse?>? onJsPrompt(JsPromptRequest jsPromptRequest) { Future<JsPromptResponse?>? onJsPrompt(JsPromptRequest jsPromptRequest) {
return null; return null;
} }
@ -633,6 +719,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
Future<HttpAuthResponse?>? onReceivedHttpAuthRequest( Future<HttpAuthResponse?>? onReceivedHttpAuthRequest(
URLAuthenticationChallenge challenge) { URLAuthenticationChallenge challenge) {
return null; return null;
@ -646,6 +733,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError))) ///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
Future<ServerTrustAuthResponse?>? onReceivedServerTrustAuthRequest( Future<ServerTrustAuthResponse?>? onReceivedServerTrustAuthRequest(
URLAuthenticationChallenge challenge) { URLAuthenticationChallenge challenge) {
return null; return null;
@ -661,6 +749,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest))) ///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
Future<ClientCertResponse?>? onReceivedClientCertRequest( Future<ClientCertResponse?>? onReceivedClientCertRequest(
URLAuthenticationChallenge challenge) { URLAuthenticationChallenge challenge) {
return null; return null;
@ -676,7 +765,7 @@ class InAppBrowser {
/// ///
///[ajaxRequest] represents the `XMLHttpRequest`. ///[ajaxRequest] represents the `XMLHttpRequest`.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -685,6 +774,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<AjaxRequest?>? shouldInterceptAjaxRequest(AjaxRequest ajaxRequest) { Future<AjaxRequest?>? shouldInterceptAjaxRequest(AjaxRequest ajaxRequest) {
return null; return null;
} }
@ -694,7 +784,7 @@ class InAppBrowser {
/// ///
///[ajaxRequest] represents the [XMLHttpRequest]. ///[ajaxRequest] represents the [XMLHttpRequest].
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -703,6 +793,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<AjaxRequestAction?>? onAjaxReadyStateChange(AjaxRequest ajaxRequest) { Future<AjaxRequestAction?>? onAjaxReadyStateChange(AjaxRequest ajaxRequest) {
return null; return null;
} }
@ -712,7 +803,7 @@ class InAppBrowser {
/// ///
///[ajaxRequest] represents the [XMLHttpRequest]. ///[ajaxRequest] represents the [XMLHttpRequest].
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -721,6 +812,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<AjaxRequestAction?>? onAjaxProgress(AjaxRequest ajaxRequest) { Future<AjaxRequestAction?>? onAjaxProgress(AjaxRequest ajaxRequest) {
return null; return null;
} }
@ -730,7 +822,7 @@ class InAppBrowser {
/// ///
///[fetchRequest] represents a resource request. ///[fetchRequest] represents a resource request.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptFetchRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptFetchRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -739,6 +831,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<FetchRequest?>? shouldInterceptFetchRequest( Future<FetchRequest?>? shouldInterceptFetchRequest(
FetchRequest fetchRequest) { FetchRequest fetchRequest) {
return null; return null;
@ -756,6 +849,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean))) ///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)))
///- iOS ///- iOS
///- MacOS
void onUpdateVisitedHistory(Uri? url, bool? isReload) {} void onUpdateVisitedHistory(Uri? url, bool? isReload) {}
///Use [onPrintRequest] instead ///Use [onPrintRequest] instead
@ -773,6 +867,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<bool?>? onPrintRequest( Future<bool?>? onPrintRequest(
Uri? url, PrintJobController? printJobController) { Uri? url, PrintJobController? printJobController) {
return null; return null;
@ -792,6 +887,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback))) ///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback)))
///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification)) ///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification))
///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification))
void onEnterFullscreen() {} void onEnterFullscreen() {}
///Event fired when the current page has exited full screen mode. ///Event fired when the current page has exited full screen mode.
@ -799,6 +895,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView())) ///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()))
///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification)) ///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification))
///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification))
void onExitFullscreen() {} void onExitFullscreen() {}
///Called when the web view begins to receive web content. ///Called when the web view begins to receive web content.
@ -811,6 +908,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
void onPageCommitVisible(Uri? url) {} void onPageCommitVisible(Uri? url) {}
///Event fired when a change in the document title occurred. ///Event fired when a change in the document title occurred.
@ -820,6 +918,7 @@ class InAppBrowser {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)))
///- iOS ///- iOS
///- MacOS
void onTitleChanged(String? title) {} void onTitleChanged(String? title) {}
///Event fired to respond to the results of an over-scroll operation. ///Event fired to respond to the results of an over-scroll operation.
@ -888,9 +987,12 @@ class InAppBrowser {
/// ///
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT]. ///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
/// ///
///**NOTE for MacOS**: available only on iOS 12.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest))) ///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)))
///- iOS ///- iOS
///- MacOS
Future<PermissionResponse?>? onPermissionRequest( Future<PermissionResponse?>? onPermissionRequest(
PermissionRequest permissionRequest) { PermissionRequest permissionRequest) {
return null; return null;
@ -1112,6 +1214,7 @@ class InAppBrowser {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) ///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
void onWebContentProcessDidTerminate() {} void onWebContentProcessDidTerminate() {}
///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead. ///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead.
@ -1122,6 +1225,7 @@ class InAppBrowser {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
void onDidReceiveServerRedirectForProvisionalNavigation() {} void onDidReceiveServerRedirectForProvisionalNavigation() {}
///Use [onNavigationResponse] instead. ///Use [onNavigationResponse] instead.
@ -1135,10 +1239,11 @@ class InAppBrowser {
/// ///
///[navigationResponse] represents the navigation response. ///[navigationResponse] represents the navigation response.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
Future<NavigationResponseAction?>? onNavigationResponse( Future<NavigationResponseAction?>? onNavigationResponse(
NavigationResponse navigationResponse) { NavigationResponse navigationResponse) {
return null; return null;
@ -1155,10 +1260,13 @@ class InAppBrowser {
/// ///
///[challenge] represents the authentication challenge. ///[challenge] represents the authentication challenge.
/// ///
///**NOTE**: available only on iOS 14.0+. ///**NOTE for iOS**: available only on iOS 14.0+.
///
///**NOTE for MacOS**: available only on MacOS 11.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
Future<ShouldAllowDeprecatedTLSAction?>? shouldAllowDeprecatedTLS( Future<ShouldAllowDeprecatedTLSAction?>? shouldAllowDeprecatedTLS(
URLAuthenticationChallenge challenge) { URLAuthenticationChallenge challenge) {
return null; return null;
@ -1166,10 +1274,13 @@ class InAppBrowser {
///Event fired when a change in the camera capture state occurred. ///Event fired when a change in the camera capture state occurred.
/// ///
///**NOTE**: available only on iOS 15.0+. ///**NOTE for iOS**: available only on iOS 15.0+.
///
///**NOTE for MacOS**: available only on MacOS 12.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
void onCameraCaptureStateChanged( void onCameraCaptureStateChanged(
MediaCaptureState? oldState, MediaCaptureState? oldState,
MediaCaptureState? newState, MediaCaptureState? newState,
@ -1177,10 +1288,13 @@ class InAppBrowser {
///Event fired when a change in the microphone capture state occurred. ///Event fired when a change in the microphone capture state occurred.
/// ///
///**NOTE**: available only on iOS 15.0+. ///**NOTE for iOS**: available only on iOS 15.0+.
///
///**NOTE for MacOS**: available only on MacOS 12.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
void onMicrophoneCaptureStateChanged( void onMicrophoneCaptureStateChanged(
MediaCaptureState? oldState, MediaCaptureState? oldState,
MediaCaptureState? newState, MediaCaptureState? newState,

View File

@ -2,7 +2,10 @@ import 'dart:ui';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview/src/types/main.dart'; import 'package:flutter_inappwebview/src/types/main.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../types/modal_presentation_style.dart';
import '../types/modal_transition_style.dart';
import '../util.dart'; import '../util.dart';
import '../in_app_webview/in_app_webview_settings.dart'; import '../in_app_webview/in_app_webview_settings.dart';
@ -13,6 +16,8 @@ import '../in_app_webview/android/in_app_webview_options.dart';
import 'apple/in_app_browser_options.dart'; import 'apple/in_app_browser_options.dart';
import '../in_app_webview/apple/in_app_webview_options.dart'; import '../in_app_webview/apple/in_app_webview_options.dart';
part 'in_app_browser_settings.g.dart';
///Class that represents the settings that can be used for an [InAppBrowser] instance. ///Class that represents the settings that can be used for an [InAppBrowser] instance.
class InAppBrowserClassSettings { class InAppBrowserClassSettings {
///Browser settings. ///Browser settings.
@ -50,8 +55,8 @@ class InAppBrowserClassSettings {
if (instance == null) { if (instance == null) {
instance = InAppBrowserClassSettings(); instance = InAppBrowserClassSettings();
} }
instance.browserSettings = InAppBrowserSettings.fromMap(options); instance.browserSettings = InAppBrowserSettings.fromMap(options) ?? InAppBrowserSettings();
instance.webViewSettings = InAppWebViewSettings.fromMap(options); instance.webViewSettings = InAppWebViewSettings.fromMap(options) ?? InAppWebViewSettings();
return instance; return instance;
} }
@ -84,7 +89,8 @@ class BrowserOptions {
} }
///This class represents all [InAppBrowser] settings available. ///This class represents all [InAppBrowser] settings available.
class InAppBrowserSettings @ExchangeableObject(copyMethod: true)
class InAppBrowserSettings_
implements BrowserOptions, AndroidOptions, IosOptions { implements BrowserOptions, AndroidOptions, IosOptions {
///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally. ///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally.
///The default value is `false`. ///The default value is `false`.
@ -92,20 +98,23 @@ class InAppBrowserSettings
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
bool hidden; ///- MacOS
bool? hidden;
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`. ///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
bool hideToolbarTop; ///- MacOS
bool? hideToolbarTop;
///Set the custom background color of the toolbar at the top. ///Set the custom background color of the toolbar at the top.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Color? toolbarTopBackgroundColor; Color? toolbarTopBackgroundColor;
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`. ///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
@ -113,50 +122,53 @@ class InAppBrowserSettings
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
bool hideUrlBar; ///- MacOS
bool? hideUrlBar;
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`. ///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
bool hideProgressBar; ///- MacOS
bool? hideProgressBar;
///Set to `true` if you want the title should be displayed. The default value is `false`. ///Set to `true` if you want the title should be displayed. The default value is `false`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
bool hideTitleBar; bool? hideTitleBar;
///Set the action bar's title. ///Set the action bar's title.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- MacOS
String? toolbarTopFixedTitle; String? toolbarTopFixedTitle;
///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`. ///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
bool closeOnCannotGoBack; bool? closeOnCannotGoBack;
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`. ///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
bool allowGoBackWithBackButton; bool? allowGoBackWithBackButton;
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`. ///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
bool shouldCloseOnBackButtonPressed; bool? shouldCloseOnBackButtonPressed;
///Set to `true` to set the toolbar at the top translucent. The default value is `true`. ///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
bool toolbarTopTranslucent; bool? toolbarTopTranslucent;
///Set the tint color to apply to the navigation bar background. ///Set the tint color to apply to the navigation bar background.
/// ///
@ -174,7 +186,7 @@ class InAppBrowserSettings
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
bool hideToolbarBottom; bool? hideToolbarBottom;
///Set the custom background color of the toolbar at the bottom. ///Set the custom background color of the toolbar at the bottom.
/// ///
@ -192,7 +204,7 @@ class InAppBrowserSettings
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
bool toolbarBottomTranslucent; bool? toolbarBottomTranslucent;
///Set the custom text for the close button. ///Set the custom text for the close button.
/// ///
@ -210,15 +222,15 @@ class InAppBrowserSettings
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
ModalPresentationStyle presentationStyle; ModalPresentationStyle_? presentationStyle;
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL]. ///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
ModalTransitionStyle transitionStyle; ModalTransitionStyle_? transitionStyle;
InAppBrowserSettings( InAppBrowserSettings_(
{this.hidden = false, {this.hidden = false,
this.hideToolbarTop = false, this.hideToolbarTop = false,
this.toolbarTopBackgroundColor, this.toolbarTopBackgroundColor,
@ -232,8 +244,8 @@ class InAppBrowserSettings
this.toolbarBottomTranslucent = true, this.toolbarBottomTranslucent = true,
this.closeButtonCaption, this.closeButtonCaption,
this.closeButtonColor, this.closeButtonColor,
this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, this.presentationStyle = ModalPresentationStyle_.FULL_SCREEN,
this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL, this.transitionStyle = ModalTransitionStyle_.COVER_VERTICAL,
this.hideTitleBar = false, this.hideTitleBar = false,
this.toolbarTopFixedTitle, this.toolbarTopFixedTitle,
this.closeOnCannotGoBack = true, this.closeOnCannotGoBack = true,
@ -241,81 +253,21 @@ class InAppBrowserSettings
this.shouldCloseOnBackButtonPressed = false}); this.shouldCloseOnBackButtonPressed = false});
@override @override
Map<String, dynamic> toMap() { @ExchangeableObjectMethod(ignore: true)
return { InAppBrowserSettings_ copy() {
"hidden": hidden, throw UnimplementedError();
"hideToolbarTop": hideToolbarTop,
"toolbarTopBackgroundColor": toolbarTopBackgroundColor?.toHex(),
"hideUrlBar": hideUrlBar,
"hideProgressBar": hideProgressBar,
"hideTitleBar": hideTitleBar,
"toolbarTopFixedTitle": toolbarTopFixedTitle,
"closeOnCannotGoBack": closeOnCannotGoBack,
"allowGoBackWithBackButton": allowGoBackWithBackButton,
"shouldCloseOnBackButtonPressed": shouldCloseOnBackButtonPressed,
"toolbarTopTranslucent": toolbarTopTranslucent,
"toolbarTopTintColor": toolbarTopTintColor?.toHex(),
"hideToolbarBottom": hideToolbarBottom,
"toolbarBottomBackgroundColor": toolbarBottomBackgroundColor?.toHex(),
"toolbarBottomTintColor": toolbarBottomTintColor?.toHex(),
"toolbarBottomTranslucent": toolbarBottomTranslucent,
"closeButtonCaption": closeButtonCaption,
"closeButtonColor": closeButtonColor?.toHex(),
"presentationStyle": presentationStyle.toNativeValue(),
"transitionStyle": transitionStyle.toNativeValue(),
};
}
static InAppBrowserSettings fromMap(Map<String, dynamic> map) {
var settings = InAppBrowserSettings();
settings.hidden = map["hidden"];
settings.hideToolbarTop = map["hideToolbarTop"];
settings.toolbarTopBackgroundColor =
UtilColor.fromHex(map["toolbarTopBackgroundColor"]);
settings.hideUrlBar = map["hideUrlBar"];
settings.hideProgressBar = map["hideProgressBar"];
if (defaultTargetPlatform == TargetPlatform.android) {
settings.hideTitleBar = map["hideTitleBar"];
settings.toolbarTopFixedTitle = map["toolbarTopFixedTitle"];
settings.closeOnCannotGoBack = map["closeOnCannotGoBack"];
settings.allowGoBackWithBackButton = map["allowGoBackWithBackButton"];
settings.shouldCloseOnBackButtonPressed =
map["shouldCloseOnBackButtonPressed"];
}
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
settings.toolbarTopTranslucent = map["toolbarTopTranslucent"];
settings.toolbarTopTintColor =
UtilColor.fromHex(map["toolbarTopTintColor"]);
settings.hideToolbarBottom = map["hideToolbarBottom"];
settings.toolbarBottomBackgroundColor =
UtilColor.fromHex(map["toolbarBottomBackgroundColor"]);
settings.toolbarBottomTintColor =
UtilColor.fromHex(map["toolbarBottomTintColor"]);
settings.toolbarBottomTranslucent = map["toolbarBottomTranslucent"];
settings.closeButtonCaption = map["closeButtonCaption"];
settings.closeButtonColor = UtilColor.fromHex(map["closeButtonColor"]);
settings.presentationStyle =
ModalPresentationStyle.fromNativeValue(map["presentationStyle"])!;
settings.transitionStyle =
ModalTransitionStyle.fromNativeValue(map["transitionStyle"])!;
}
return settings;
} }
@override @override
@ExchangeableObjectMethod(ignore: true)
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return this.toMap(); throw UnimplementedError();
} }
@override @override
String toString() { @ExchangeableObjectMethod(ignore: true)
return toMap().toString(); Map<String, dynamic> toMap() {
} throw UnimplementedError();
@override
InAppBrowserSettings copy() {
return InAppBrowserSettings.fromMap(this.toMap());
} }
} }

View File

@ -0,0 +1,259 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'in_app_browser_settings.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///This class represents all [InAppBrowser] settings available.
class InAppBrowserSettings
implements BrowserOptions, AndroidOptions, IosOptions {
///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally.
///The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hidden;
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideToolbarTop;
///Set the custom background color of the toolbar at the top.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Color? toolbarTopBackgroundColor;
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideUrlBar;
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideProgressBar;
///Set to `true` if you want the title should be displayed. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? hideTitleBar;
///Set the action bar's title.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
String? toolbarTopFixedTitle;
///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? closeOnCannotGoBack;
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? allowGoBackWithBackButton;
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? shouldCloseOnBackButtonPressed;
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? toolbarTopTranslucent;
///Set the tint color to apply to the navigation bar background.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarTopBarTintColor;
///Set the tint color to apply to the navigation items and bar button items.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarTopTintColor;
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? hideToolbarBottom;
///Set the custom background color of the toolbar at the bottom.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarBottomBackgroundColor;
///Set the tint color to apply to the bar button items.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarBottomTintColor;
///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? toolbarBottomTranslucent;
///Set the custom text for the close button.
///
///**Supported Platforms/Implementations**:
///- iOS
String? closeButtonCaption;
///Set the custom color for the close button.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? closeButtonColor;
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
///
///**Supported Platforms/Implementations**:
///- iOS
ModalPresentationStyle? presentationStyle;
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
///
///**Supported Platforms/Implementations**:
///- iOS
ModalTransitionStyle? transitionStyle;
InAppBrowserSettings(
{this.hidden = false,
this.hideToolbarTop = false,
this.toolbarTopBackgroundColor,
this.hideUrlBar = false,
this.hideProgressBar = false,
this.hideTitleBar = false,
this.toolbarTopFixedTitle,
this.closeOnCannotGoBack = true,
this.allowGoBackWithBackButton = true,
this.shouldCloseOnBackButtonPressed = false,
this.toolbarTopTranslucent = true,
this.toolbarTopTintColor,
this.hideToolbarBottom = false,
this.toolbarBottomBackgroundColor,
this.toolbarBottomTintColor,
this.toolbarBottomTranslucent = true,
this.closeButtonCaption,
this.closeButtonColor,
this.presentationStyle = ModalPresentationStyle.FULL_SCREEN,
this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL});
///Gets a possible [InAppBrowserSettings] instance from a [Map] value.
static InAppBrowserSettings? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = InAppBrowserSettings(
toolbarTopBackgroundColor: map['toolbarTopBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopBackgroundColor'])
: null,
toolbarTopFixedTitle: map['toolbarTopFixedTitle'],
toolbarTopTintColor: map['toolbarTopTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopTintColor'])
: null,
toolbarBottomBackgroundColor: map['toolbarBottomBackgroundColor'] != null
? UtilColor.fromStringRepresentation(
map['toolbarBottomBackgroundColor'])
: null,
toolbarBottomTintColor: map['toolbarBottomTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarBottomTintColor'])
: null,
closeButtonCaption: map['closeButtonCaption'],
closeButtonColor: map['closeButtonColor'] != null
? UtilColor.fromStringRepresentation(map['closeButtonColor'])
: null,
);
instance.hidden = map['hidden'];
instance.hideToolbarTop = map['hideToolbarTop'];
instance.hideUrlBar = map['hideUrlBar'];
instance.hideProgressBar = map['hideProgressBar'];
instance.hideTitleBar = map['hideTitleBar'];
instance.closeOnCannotGoBack = map['closeOnCannotGoBack'];
instance.allowGoBackWithBackButton = map['allowGoBackWithBackButton'];
instance.shouldCloseOnBackButtonPressed =
map['shouldCloseOnBackButtonPressed'];
instance.toolbarTopTranslucent = map['toolbarTopTranslucent'];
instance.toolbarTopBarTintColor = map['toolbarTopBarTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopBarTintColor'])
: null;
instance.hideToolbarBottom = map['hideToolbarBottom'];
instance.toolbarBottomTranslucent = map['toolbarBottomTranslucent'];
instance.presentationStyle =
ModalPresentationStyle.fromNativeValue(map['presentationStyle']);
instance.transitionStyle =
ModalTransitionStyle.fromNativeValue(map['transitionStyle']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"hidden": hidden,
"hideToolbarTop": hideToolbarTop,
"toolbarTopBackgroundColor": toolbarTopBackgroundColor?.toHex(),
"hideUrlBar": hideUrlBar,
"hideProgressBar": hideProgressBar,
"hideTitleBar": hideTitleBar,
"toolbarTopFixedTitle": toolbarTopFixedTitle,
"closeOnCannotGoBack": closeOnCannotGoBack,
"allowGoBackWithBackButton": allowGoBackWithBackButton,
"shouldCloseOnBackButtonPressed": shouldCloseOnBackButtonPressed,
"toolbarTopTranslucent": toolbarTopTranslucent,
"toolbarTopBarTintColor": toolbarTopBarTintColor?.toHex(),
"toolbarTopTintColor": toolbarTopTintColor?.toHex(),
"hideToolbarBottom": hideToolbarBottom,
"toolbarBottomBackgroundColor": toolbarBottomBackgroundColor?.toHex(),
"toolbarBottomTintColor": toolbarBottomTintColor?.toHex(),
"toolbarBottomTranslucent": toolbarBottomTranslucent,
"closeButtonCaption": closeButtonCaption,
"closeButtonColor": closeButtonColor?.toHex(),
"presentationStyle": presentationStyle?.toNativeValue(),
"transitionStyle": transitionStyle?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
///Returns a copy of InAppBrowserSettings.
InAppBrowserSettings copy() {
return InAppBrowserSettings.fromMap(toMap()) ?? InAppBrowserSettings();
}
@override
String toString() {
return 'InAppBrowserSettings{hidden: $hidden, hideToolbarTop: $hideToolbarTop, toolbarTopBackgroundColor: $toolbarTopBackgroundColor, hideUrlBar: $hideUrlBar, hideProgressBar: $hideProgressBar, hideTitleBar: $hideTitleBar, toolbarTopFixedTitle: $toolbarTopFixedTitle, closeOnCannotGoBack: $closeOnCannotGoBack, allowGoBackWithBackButton: $allowGoBackWithBackButton, shouldCloseOnBackButtonPressed: $shouldCloseOnBackButtonPressed, toolbarTopTranslucent: $toolbarTopTranslucent, toolbarTopBarTintColor: $toolbarTopBarTintColor, toolbarTopTintColor: $toolbarTopTintColor, hideToolbarBottom: $hideToolbarBottom, toolbarBottomBackgroundColor: $toolbarBottomBackgroundColor, toolbarBottomTintColor: $toolbarBottomTintColor, toolbarBottomTranslucent: $toolbarBottomTranslucent, closeButtonCaption: $closeButtonCaption, closeButtonColor: $closeButtonColor, presentationStyle: $presentationStyle, transitionStyle: $transitionStyle}';
}
}

View File

@ -1,4 +1,10 @@
export 'in_app_browser.dart'; export 'in_app_browser.dart';
export 'in_app_browser_settings.dart'; export 'in_app_browser_settings.dart'
show
InAppBrowserClassSettings,
BrowserOptions,
InAppBrowserSettings,
InAppBrowserClassOptions,
InAppBrowserOptions;
export 'android/main.dart'; export 'android/main.dart';
export 'apple/main.dart'; export 'apple/main.dart';

View File

@ -12,6 +12,7 @@ import 'mime_type_resolver.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
class InAppLocalhostServer { class InAppLocalhostServer {
bool _started = false; bool _started = false;
HttpServer? _server; HttpServer? _server;

View File

@ -23,6 +23,7 @@ import '../types/disposable.dart';
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
class HeadlessInAppWebView implements WebView, Disposable { class HeadlessInAppWebView implements WebView, Disposable {
///View ID. ///View ID.
late final String id; late final String id;
@ -192,6 +193,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
Future<void> run() async { Future<void> run() async {
if (_started) { if (_started) {
return; return;
@ -236,6 +238,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
@override @override
Future<void> dispose() async { Future<void> dispose() async {
if (!_running) { if (!_running) {
@ -253,6 +256,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
bool isRunning() { bool isRunning() {
return _running; return _running;
} }
@ -270,6 +274,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
Future<void> setSize(Size size) async { Future<void> setSize(Size size) async {
if (!_running) { if (!_running) {
return; return;
@ -288,6 +293,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- Web ///- Web
///- MacOS
Future<Size?> getSize() async { Future<Size?> getSize() async {
if (!_running) { if (!_running) {
return null; return null;

View File

@ -1343,6 +1343,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getUrl](https://developer.android.com/reference/android/webkit/WebView#getUrl())) ///- Android native WebView ([Official API - WebView.getUrl](https://developer.android.com/reference/android/webkit/WebView#getUrl()))
///- iOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url)) ///- iOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url))
///- MacOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url))
///- Web ///- Web
Future<Uri?> getUrl() async { Future<Uri?> getUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1357,6 +1358,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getTitle](https://developer.android.com/reference/android/webkit/WebView#getTitle())) ///- Android native WebView ([Official API - WebView.getTitle](https://developer.android.com/reference/android/webkit/WebView#getTitle()))
///- iOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title)) ///- iOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title))
///- MacOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title))
///- Web ///- Web
Future<String?> getTitle() async { Future<String?> getTitle() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1368,6 +1370,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getProgress](https://developer.android.com/reference/android/webkit/WebView#getProgress())) ///- Android native WebView ([Official API - WebView.getProgress](https://developer.android.com/reference/android/webkit/WebView#getProgress()))
///- iOS ([Official API - WKWebView.estimatedProgress](https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress)) ///- iOS ([Official API - WKWebView.estimatedProgress](https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress))
///- MacOS ([Official API - WKWebView.estimatedProgress](https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress))
Future<int?> getProgress() async { Future<int?> getProgress() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getProgress', args); return await _channel.invokeMethod('getProgress', args);
@ -1383,6 +1386,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<String?> getHtml() async { Future<String?> getHtml() async {
String? html; String? html;
@ -1427,6 +1431,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<List<Favicon>> getFavicons() async { Future<List<Favicon>> getFavicons() async {
List<Favicon> favicons = []; List<Favicon> favicons = [];
@ -1611,6 +1616,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))). If method is "POST", [Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])) ///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))). If method is "POST", [Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[]))
///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl)) ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl))
///- MacOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl))
///- Web ///- Web
Future<void> loadUrl( Future<void> loadUrl(
{required URLRequest urlRequest, {required URLRequest urlRequest,
@ -1646,6 +1652,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[]))) ///- Android native WebView ([Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])))
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> postUrl({required Uri url, required Uint8List postData}) async { Future<void> postUrl({required Uri url, required Uint8List postData}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
@ -1672,6 +1679,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.loadDataWithBaseURL](https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String))) ///- Android native WebView ([Official API - WebView.loadDataWithBaseURL](https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)))
///- iOS ([Official API - WKWebView.loadHTMLString](https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring) or [Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1415011-load)) ///- iOS ([Official API - WKWebView.loadHTMLString](https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring) or [Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1415011-load))
///- MacOS ([Official API - WKWebView.loadHTMLString](https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring) or [Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1415011-load))
///- Web ///- Web
Future<void> loadData( Future<void> loadData(
{required String data, {required String data,
@ -1741,6 +1749,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))) ///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String)))
///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load)) ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load))
///- MacOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load))
///- Web ///- Web
Future<void> loadFile({required String assetFilePath}) async { Future<void> loadFile({required String assetFilePath}) async {
assert(assetFilePath.isNotEmpty); assert(assetFilePath.isNotEmpty);
@ -1756,6 +1765,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.reload](https://developer.android.com/reference/android/webkit/WebView#reload())) ///- Android native WebView ([Official API - WebView.reload](https://developer.android.com/reference/android/webkit/WebView#reload()))
///- iOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload)) ///- iOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload))
///- MacOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload))
///- Web ([Official API - Location.reload](https://developer.mozilla.org/en-US/docs/Web/API/Location/reload)) ///- Web ([Official API - Location.reload](https://developer.mozilla.org/en-US/docs/Web/API/Location/reload))
Future<void> reload() async { Future<void> reload() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1769,6 +1779,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.goBack](https://developer.android.com/reference/android/webkit/WebView#goBack())) ///- Android native WebView ([Official API - WebView.goBack](https://developer.android.com/reference/android/webkit/WebView#goBack()))
///- iOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback)) ///- iOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback))
///- MacOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback))
///- Web ([Official API - History.back](https://developer.mozilla.org/en-US/docs/Web/API/History/back)) ///- Web ([Official API - History.back](https://developer.mozilla.org/en-US/docs/Web/API/History/back))
Future<void> goBack() async { Future<void> goBack() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1780,6 +1791,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.canGoBack](https://developer.android.com/reference/android/webkit/WebView#canGoBack())) ///- Android native WebView ([Official API - WebView.canGoBack](https://developer.android.com/reference/android/webkit/WebView#canGoBack()))
///- iOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback)) ///- iOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback))
///- MacOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback))
Future<bool> canGoBack() async { Future<bool> canGoBack() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('canGoBack', args); return await _channel.invokeMethod('canGoBack', args);
@ -1792,6 +1804,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.goForward](https://developer.android.com/reference/android/webkit/WebView#goForward())) ///- Android native WebView ([Official API - WebView.goForward](https://developer.android.com/reference/android/webkit/WebView#goForward()))
///- iOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward)) ///- iOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward))
///- MacOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward))
///- Web ([Official API - History.forward](https://developer.mozilla.org/en-US/docs/Web/API/History/forward)) ///- Web ([Official API - History.forward](https://developer.mozilla.org/en-US/docs/Web/API/History/forward))
Future<void> goForward() async { Future<void> goForward() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1803,6 +1816,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.canGoForward](https://developer.android.com/reference/android/webkit/WebView#canGoForward())) ///- Android native WebView ([Official API - WebView.canGoForward](https://developer.android.com/reference/android/webkit/WebView#canGoForward()))
///- iOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward)) ///- iOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward))
///- MacOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward))
Future<bool> canGoForward() async { Future<bool> canGoForward() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('canGoForward', args); return await _channel.invokeMethod('canGoForward', args);
@ -1815,6 +1829,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.goBackOrForward](https://developer.android.com/reference/android/webkit/WebView#goBackOrForward(int))) ///- Android native WebView ([Official API - WebView.goBackOrForward](https://developer.android.com/reference/android/webkit/WebView#goBackOrForward(int)))
///- iOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go)) ///- iOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go))
///- MacOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go))
///- Web ([Official API - History.go](https://developer.mozilla.org/en-US/docs/Web/API/History/go)) ///- Web ([Official API - History.go](https://developer.mozilla.org/en-US/docs/Web/API/History/go))
Future<void> goBackOrForward({required int steps}) async { Future<void> goBackOrForward({required int steps}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1827,6 +1842,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.canGoBackOrForward](https://developer.android.com/reference/android/webkit/WebView#canGoBackOrForward(int))) ///- Android native WebView ([Official API - WebView.canGoBackOrForward](https://developer.android.com/reference/android/webkit/WebView#canGoBackOrForward(int)))
///- iOS ///- iOS
///- MacOS
Future<bool> canGoBackOrForward({required int steps}) async { Future<bool> canGoBackOrForward({required int steps}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('steps', () => steps); args.putIfAbsent('steps', () => steps);
@ -1840,6 +1856,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> goTo({required WebHistoryItem historyItem}) async { Future<void> goTo({required WebHistoryItem historyItem}) async {
var steps = historyItem.offset; var steps = historyItem.offset;
@ -1853,6 +1870,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<bool> isLoading() async { Future<bool> isLoading() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1866,6 +1884,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.stopLoading](https://developer.android.com/reference/android/webkit/WebView#stopLoading())) ///- Android native WebView ([Official API - WebView.stopLoading](https://developer.android.com/reference/android/webkit/WebView#stopLoading()))
///- iOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading)) ///- iOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading))
///- MacOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading))
///- Web ([Official API - Window.stop](https://developer.mozilla.org/en-US/docs/Web/API/Window/stop)) ///- Web ([Official API - Window.stop](https://developer.mozilla.org/en-US/docs/Web/API/Window/stop))
Future<void> stopLoading() async { Future<void> stopLoading() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1879,7 +1898,7 @@ class InAppWebViewController {
///This parameter doesnt apply to changes you make to the underlying web content, such as the documents DOM structure. ///This parameter doesnt apply to changes you make to the underlying web content, such as the documents DOM structure.
///Those changes remain visible to all scripts, regardless of which content world you specify. ///Those changes remain visible to all scripts, regardless of which content world you specify.
///For more information about content worlds, see [ContentWorld]. ///For more information about content worlds, see [ContentWorld].
///Available on iOS 14.0+. ///Available on iOS 14.0+ and MacOS 11.0+.
///**NOTE**: not used on Web. ///**NOTE**: not used on Web.
/// ///
///**NOTE**: This method shouldn't be called in the [WebView.onWebViewCreated] or [WebView.onLoadStart] events, ///**NOTE**: This method shouldn't be called in the [WebView.onWebViewCreated] or [WebView.onLoadStart] events,
@ -1892,6 +1911,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.evaluateJavascript](https://developer.android.com/reference/android/webkit/WebView#evaluateJavascript(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.String%3E))) ///- Android native WebView ([Official API - WebView.evaluateJavascript](https://developer.android.com/reference/android/webkit/WebView#evaluateJavascript(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)))
///- iOS ([Official API - WKWebView.evaluateJavascript](https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript)) ///- iOS ([Official API - WKWebView.evaluateJavascript](https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript))
///- MacOS ([Official API - WKWebView.evaluateJavascript](https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript))
///- Web ([Official API - Window.eval](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval?retiredLocale=it)) ///- Web ([Official API - Window.eval](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval?retiredLocale=it))
Future<dynamic> evaluateJavascript( Future<dynamic> evaluateJavascript(
{required String source, ContentWorld? contentWorld}) async { {required String source, ContentWorld? contentWorld}) async {
@ -1924,6 +1944,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> injectJavascriptFileFromUrl( Future<void> injectJavascriptFileFromUrl(
{required Uri urlFile, {required Uri urlFile,
@ -1952,6 +1973,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<dynamic> injectJavascriptFileFromAsset( Future<dynamic> injectJavascriptFileFromAsset(
{required String assetFilePath}) async { {required String assetFilePath}) async {
@ -1971,6 +1993,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> injectCSSCode({required String source}) async { Future<void> injectCSSCode({required String source}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1992,6 +2015,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> injectCSSFileFromUrl( Future<void> injectCSSFileFromUrl(
{required Uri urlFile, {required Uri urlFile,
@ -2016,6 +2040,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> injectCSSFileFromAsset({required String assetFilePath}) async { Future<void> injectCSSFileFromAsset({required String assetFilePath}) async {
String source = await rootBundle.loadString(assetFilePath); String source = await rootBundle.loadString(assetFilePath);
@ -2076,6 +2101,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
void addJavaScriptHandler( void addJavaScriptHandler(
{required String handlerName, {required String handlerName,
required JavaScriptHandlerCallback callback}) { required JavaScriptHandlerCallback callback}) {
@ -2091,6 +2117,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
JavaScriptHandlerCallback? removeJavaScriptHandler( JavaScriptHandlerCallback? removeJavaScriptHandler(
{required String handlerName}) { {required String handlerName}) {
return this.javaScriptHandlersMap.remove(handlerName); return this.javaScriptHandlersMap.remove(handlerName);
@ -2102,9 +2129,12 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 11.0+. ///**NOTE for iOS**: available on iOS 11.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 10.13+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKWebView.takeSnapshot](https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot)) ///- iOS ([Official API - WKWebView.takeSnapshot](https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot))
///- MacOS ([Official API - WKWebView.takeSnapshot](https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot))
Future<Uint8List?> takeScreenshot( Future<Uint8List?> takeScreenshot(
{ScreenshotConfiguration? screenshotConfiguration}) async { {ScreenshotConfiguration? screenshotConfiguration}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2117,7 +2147,7 @@ class InAppWebViewController {
@Deprecated('Use setSettings instead') @Deprecated('Use setSettings instead')
Future<void> setOptions({required InAppWebViewGroupOptions options}) async { Future<void> setOptions({required InAppWebViewGroupOptions options}) async {
InAppWebViewSettings settings = InAppWebViewSettings settings =
InAppWebViewSettings.fromMap(options.toMap()); InAppWebViewSettings.fromMap(options.toMap()) ?? InAppWebViewSettings();
await setSettings(settings: settings); await setSettings(settings: settings);
} }
@ -2140,6 +2170,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<void> setSettings({required InAppWebViewSettings settings}) async { Future<void> setSettings({required InAppWebViewSettings settings}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2153,6 +2184,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<InAppWebViewSettings?> getSettings() async { Future<InAppWebViewSettings?> getSettings() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2175,6 +2207,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.copyBackForwardList](https://developer.android.com/reference/android/webkit/WebView#copyBackForwardList())) ///- Android native WebView ([Official API - WebView.copyBackForwardList](https://developer.android.com/reference/android/webkit/WebView#copyBackForwardList()))
///- iOS ([Official API - WKWebView.backForwardList](https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist)) ///- iOS ([Official API - WKWebView.backForwardList](https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist))
///- MacOS ([Official API - WKWebView.backForwardList](https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist))
Future<WebHistory?> getCopyBackForwardList() async { Future<WebHistory?> getCopyBackForwardList() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? result = Map<String, dynamic>? result =
@ -2188,6 +2221,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> clearCache() async { Future<void> clearCache() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('clearCache', args); await _channel.invokeMethod('clearCache', args);
@ -2238,9 +2272,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: this method is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.scrollTo](https://developer.android.com/reference/android/view/View#scrollTo(int,%20int))) ///- Android native WebView ([Official API - View.scrollTo](https://developer.android.com/reference/android/view/View#scrollTo(int,%20int)))
///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset))
///- MacOS
///- Web ([Official API - Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)) ///- Web ([Official API - Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo))
Future<void> scrollTo( Future<void> scrollTo(
{required int x, required int y, bool animated = false}) async { {required int x, required int y, bool animated = false}) async {
@ -2261,9 +2298,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: this method is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.scrollBy](https://developer.android.com/reference/android/view/View#scrollBy(int,%20int))) ///- Android native WebView ([Official API - View.scrollBy](https://developer.android.com/reference/android/view/View#scrollBy(int,%20int)))
///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset))
///- MacOS
///- Web ([Official API - Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)) ///- Web ([Official API - Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy))
Future<void> scrollBy( Future<void> scrollBy(
{required int x, required int y, bool animated = false}) async { {required int x, required int y, bool animated = false}) async {
@ -2277,11 +2317,14 @@ class InAppWebViewController {
///On Android native WebView, it pauses all layout, parsing, and JavaScript timers for all WebViews. ///On Android native WebView, it pauses all layout, parsing, and JavaScript timers for all WebViews.
///This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused. ///This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused.
/// ///
///On iOS, it is implemented using JavaScript and it is restricted to just this WebView. ///**NOTE for iOS**: it is implemented using JavaScript and it is restricted to just this WebView.
///
///**NOTE for MacOS**: it is implemented using JavaScript and it is restricted to just this WebView.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.pauseTimers](https://developer.android.com/reference/android/webkit/WebView#pauseTimers())) ///- Android native WebView ([Official API - WebView.pauseTimers](https://developer.android.com/reference/android/webkit/WebView#pauseTimers()))
///- iOS ///- iOS
///- MacOS
Future<void> pauseTimers() async { Future<void> pauseTimers() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('pauseTimers', args); await _channel.invokeMethod('pauseTimers', args);
@ -2289,11 +2332,14 @@ class InAppWebViewController {
///On Android, it resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers. ///On Android, it resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers.
/// ///
///On iOS, it is implemented using JavaScript and it resumes all layout, parsing, and JavaScript timers to just this WebView. ///**NOTE for iOS**: it is implemented using JavaScript and it is restricted to just this WebView.
///
///**NOTE for MacOS**: it is implemented using JavaScript and it is restricted to just this WebView.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.resumeTimers](https://developer.android.com/reference/android/webkit/WebView#resumeTimers())) ///- Android native WebView ([Official API - WebView.resumeTimers](https://developer.android.com/reference/android/webkit/WebView#resumeTimers()))
///- iOS ///- iOS
///- MacOS
Future<void> resumeTimers() async { Future<void> resumeTimers() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('resumeTimers', args); await _channel.invokeMethod('resumeTimers', args);
@ -2304,13 +2350,16 @@ class InAppWebViewController {
///To obtain the [PrintJobController], use [settings] argument with [PrintJobSettings.handledByClient] to `true`. ///To obtain the [PrintJobController], use [settings] argument with [PrintJobSettings.handledByClient] to `true`.
///Otherwise this method will return `null` and the [PrintJobController] will be handled and disposed automatically by the system. ///Otherwise this method will return `null` and the [PrintJobController] will be handled and disposed automatically by the system.
/// ///
///**NOTE**: available on Android 19+. ///**NOTE for Android**: available on Android 19+.
///
///**NOTE for MacOS**: [PrintJobController] is available on MacOS 11.0+.
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. Also, [PrintJobController] is always `null`. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. Also, [PrintJobController] is always `null`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PrintManager.print](https://developer.android.com/reference/android/print/PrintManager#print(java.lang.String,%20android.print.PrintDocumentAdapter,%20android.print.PrintAttributes))) ///- Android native WebView ([Official API - PrintManager.print](https://developer.android.com/reference/android/print/PrintManager#print(java.lang.String,%20android.print.PrintDocumentAdapter,%20android.print.PrintAttributes)))
///- iOS ([Official API - UIPrintInteractionController.present](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/1618149-present)) ///- iOS ([Official API - UIPrintInteractionController.present](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/1618149-present))
///- MacOS (if 11.0+, [Official API - WKWebView.printOperation](https://developer.apple.com/documentation/webkit/wkwebview/3516861-printoperation), else [Official API - NSView.printView](https://developer.apple.com/documentation/appkit/nsview/1483705-printview))
///- Web ([Official API - Window.print](https://developer.mozilla.org/en-US/docs/Web/API/Window/print)) ///- Web ([Official API - Window.print](https://developer.mozilla.org/en-US/docs/Web/API/Window/print))
Future<PrintJobController?> printCurrentPage( Future<PrintJobController?> printCurrentPage(
{PrintJobSettings? settings}) async { {PrintJobSettings? settings}) async {
@ -2327,9 +2376,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getContentHeight](https://developer.android.com/reference/android/webkit/WebView#getContentHeight())) ///- Android native WebView ([Official API - WebView.getContentHeight](https://developer.android.com/reference/android/webkit/WebView#getContentHeight()))
///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize)) ///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize))
///- MacOS
///- Web ([Official API - Document.documentElement.scrollHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)) ///- Web ([Official API - Document.documentElement.scrollHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight))
Future<int?> getContentHeight() async { Future<int?> getContentHeight() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2345,6 +2397,33 @@ class InAppWebViewController {
return height; return height;
} }
///Gets the width of the HTML content.
///
///**NOTE for Android**: it is implemented using JavaScript.
///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize))
///- MacOS
///- Web ([Official API - Document.documentElement.scrollWidth](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth))
Future<int?> getContentWidth() async {
Map<String, dynamic> args = <String, dynamic>{};
var height = await _channel.invokeMethod('getContentWidth', args);
if (height == null || height == 0) {
// try to use javascript
var scrollHeight = await evaluateJavascript(
source: "document.documentElement.scrollWidth;");
if (scrollHeight != null && scrollHeight is num) {
height = scrollHeight.toInt();
}
}
return height;
}
///Performs a zoom operation in this WebView. ///Performs a zoom operation in this WebView.
/// ///
///[zoomFactor] represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 (excluded) to 100.0 (included). ///[zoomFactor] represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 (excluded) to 100.0 (included).
@ -2381,6 +2460,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getOriginalUrl](https://developer.android.com/reference/android/webkit/WebView#getOriginalUrl())) ///- Android native WebView ([Official API - WebView.getOriginalUrl](https://developer.android.com/reference/android/webkit/WebView#getOriginalUrl()))
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<Uri?> getOriginalUrl() async { Future<Uri?> getOriginalUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2415,6 +2495,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<String?> getSelectedText() async { Future<String?> getSelectedText() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2515,6 +2596,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<List<MetaTag>> getMetaTags() async { Future<List<MetaTag>> getMetaTags() async {
List<MetaTag> metaTags = []; List<MetaTag> metaTags = [];
@ -2578,13 +2660,14 @@ class InAppWebViewController {
///Returns an instance of [Color] representing the `content` value of the ///Returns an instance of [Color] representing the `content` value of the
///`<meta name="theme-color" content="">` tag of the current WebView, if available, otherwise `null`. ///`<meta name="theme-color" content="">` tag of the current WebView, if available, otherwise `null`.
/// ///
///**NOTE**: on Android, Web and iOS < 15.0, it is implemented using JavaScript. ///**NOTE**: on Android, Web, iOS < 15.0 and MacOS < 12.0, it is implemented using JavaScript.
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKWebView.themeColor](https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor)) ///- iOS ([Official API - WKWebView.themeColor](https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor))
///- MacOS ([Official API - WKWebView.themeColor](https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor))
///- Web ///- Web
Future<Color?> getMetaThemeColor() async { Future<Color?> getMetaThemeColor() async {
Color? themeColor; Color? themeColor;
@ -2626,9 +2709,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.getScrollX](https://developer.android.com/reference/android/view/View#getScrollX())) ///- Android native WebView ([Official API - View.getScrollX](https://developer.android.com/reference/android/view/View#getScrollX()))
///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset))
///- MacOS
///- Web ([Official API - Window.scrollX](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX)) ///- Web ([Official API - Window.scrollX](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX))
Future<int?> getScrollX() async { Future<int?> getScrollX() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2639,9 +2725,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.getScrollY](https://developer.android.com/reference/android/view/View#getScrollY())) ///- Android native WebView ([Official API - View.getScrollY](https://developer.android.com/reference/android/view/View#getScrollY()))
///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset))
///- MacOS
///- Web ([Official API - Window.scrollY](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY)) ///- Web ([Official API - Window.scrollY](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY))
Future<int?> getScrollY() async { Future<int?> getScrollY() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2653,6 +2742,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.getCertificate](https://developer.android.com/reference/android/webkit/WebView#getCertificate())) ///- Android native WebView ([Official API - WebView.getCertificate](https://developer.android.com/reference/android/webkit/WebView#getCertificate()))
///- iOS ///- iOS
///- MacOS
Future<SslCertificate?> getCertificate() async { Future<SslCertificate?> getCertificate() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? sslCertificateMap = Map<String, dynamic>? sslCertificateMap =
@ -2663,13 +2753,14 @@ class InAppWebViewController {
///Injects the specified [userScript] into the webpages content. ///Injects the specified [userScript] into the webpages content.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKUserContentController.addUserScript](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript)) ///- iOS ([Official API - WKUserContentController.addUserScript](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript))
///- MacOS ([Official API - WKUserContentController.addUserScript](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript))
Future<void> addUserScript({required UserScript userScript}) async { Future<void> addUserScript({required UserScript userScript}) async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS); defaultTargetPlatform != TargetPlatform.iOS);
@ -2684,13 +2775,14 @@ class InAppWebViewController {
///Injects the [userScripts] into the webpages content. ///Injects the [userScripts] into the webpages content.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> addUserScripts({required List<UserScript> userScripts}) async { Future<void> addUserScripts({required List<UserScript> userScripts}) async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS); defaultTargetPlatform != TargetPlatform.iOS);
@ -2704,13 +2796,14 @@ class InAppWebViewController {
///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load.
///Returns `true` if [userScript] was in the list, `false` otherwise. ///Returns `true` if [userScript] was in the list, `false` otherwise.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<bool> removeUserScript({required UserScript userScript}) async { Future<bool> removeUserScript({required UserScript userScript}) async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS); defaultTargetPlatform != TargetPlatform.iOS);
@ -2732,13 +2825,14 @@ class InAppWebViewController {
///Removes all the [UserScript]s with [groupName] as group name from the webpages content. ///Removes all the [UserScript]s with [groupName] as group name from the webpages content.
///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> removeUserScriptsByGroupName({required String groupName}) async { Future<void> removeUserScriptsByGroupName({required String groupName}) async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS); defaultTargetPlatform != TargetPlatform.iOS);
@ -2751,13 +2845,14 @@ class InAppWebViewController {
///Removes the [userScripts] from the webpages content. ///Removes the [userScripts] from the webpages content.
///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<void> removeUserScripts( Future<void> removeUserScripts(
{required List<UserScript> userScripts}) async { {required List<UserScript> userScripts}) async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
@ -2770,13 +2865,14 @@ class InAppWebViewController {
///Removes all the user scripts from the webpages content. ///Removes all the user scripts from the webpages content.
/// ///
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native WebKit APIs.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKUserContentController.removeAllUserScripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts)) ///- iOS ([Official API - WKUserContentController.removeAllUserScripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts))
///- MacOS ([Official API - WKUserContentController.removeAllUserScripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts))
Future<void> removeAllUserScripts() async { Future<void> removeAllUserScripts() async {
assert(_webview?.windowId == null || assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS); defaultTargetPlatform != TargetPlatform.iOS);
@ -2818,6 +2914,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKWebView.callAsyncJavaScript](https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript)) ///- iOS ([Official API - WKWebView.callAsyncJavaScript](https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript))
///- MacOS ([Official API - WKWebView.callAsyncJavaScript](https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript))
Future<CallAsyncJavaScriptResult?> callAsyncJavaScript( Future<CallAsyncJavaScriptResult?> callAsyncJavaScript(
{required String functionBody, {required String functionBody,
Map<String, dynamic> arguments = const <String, dynamic>{}, Map<String, dynamic> arguments = const <String, dynamic>{},
@ -2847,11 +2944,14 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: Available on iOS 14.0+. If [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.WEBARCHIVE] file extension. ///**NOTE for iOS**: Available on iOS 14.0+. If [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.WEBARCHIVE] file extension.
/// ///
///**NOTE for MacOS**: Available on MacOS 11.0+. If [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.WEBARCHIVE] file extension.
///
///**NOTE for Android**: if [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.MHT] file extension. ///**NOTE for Android**: if [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.MHT] file extension.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.saveWebArchive](https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E))) ///- Android native WebView ([Official API - WebView.saveWebArchive](https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)))
///- iOS ///- iOS
///- MacOS
Future<String?> saveWebArchive( Future<String?> saveWebArchive(
{required String filePath, bool autoname = false}) async { {required String filePath, bool autoname = false}) async {
if (!autoname) { if (!autoname) {
@ -2879,6 +2979,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ([Official API - Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext)) ///- Web ([Official API - Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext))
Future<bool> isSecureContext() async { Future<bool> isSecureContext() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -2894,11 +2995,14 @@ class InAppWebViewController {
/// ///
///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL]. ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL].
/// ///
///**NOTE**: On iOS, it is implemented using JavaScript. ///**NOTE for iOS**: it is implemented using JavaScript.
///
///**NOTE for MacOS**: it is implemented using JavaScript.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewCompat.createWebMessageChannel](https://developer.android.com/reference/androidx/webkit/WebViewCompat#createWebMessageChannel(android.webkit.WebView))) ///- Android native WebView ([Official API - WebViewCompat.createWebMessageChannel](https://developer.android.com/reference/androidx/webkit/WebViewCompat#createWebMessageChannel(android.webkit.WebView)))
///- iOS ///- iOS
///- MacOS
Future<WebMessageChannel?> createWebMessageChannel() async { Future<WebMessageChannel?> createWebMessageChannel() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? result = Map<String, dynamic>? result =
@ -2914,11 +3018,14 @@ class InAppWebViewController {
/// ///
///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.POST_WEB_MESSAGE]. ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.POST_WEB_MESSAGE].
/// ///
///**NOTE**: On iOS, it is implemented using JavaScript. ///**NOTE for iOS**: it is implemented using JavaScript.
///
///**NOTE for MacOS**: it is implemented using JavaScript.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewCompat.postWebMessage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#postWebMessage(android.webkit.WebView,%20androidx.webkit.WebMessageCompat,%20android.net.Uri))) ///- Android native WebView ([Official API - WebViewCompat.postWebMessage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#postWebMessage(android.webkit.WebView,%20androidx.webkit.WebMessageCompat,%20android.net.Uri)))
///- iOS ///- iOS
///- MacOS
Future<void> postWebMessage( Future<void> postWebMessage(
{required WebMessage message, Uri? targetOrigin}) async { {required WebMessage message, Uri? targetOrigin}) async {
if (targetOrigin == null) { if (targetOrigin == null) {
@ -3086,11 +3193,14 @@ class InAppWebViewController {
/// ///
///**NOTE for Android**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.WEB_MESSAGE_LISTENER]. ///**NOTE for Android**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.WEB_MESSAGE_LISTENER].
/// ///
///**NOTE for iOS**: This is implemented using Javascript. ///**NOTE for iOS**: it is implemented using JavaScript.
///
///**NOTE for MacOS**: it is implemented using JavaScript.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewCompat.WebMessageListener](https://developer.android.com/reference/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,%20java.lang.String,%20java.util.Set%3Cjava.lang.String%3E,%20androidx.webkit.WebViewCompat.WebMessageListener))) ///- Android native WebView ([Official API - WebViewCompat.WebMessageListener](https://developer.android.com/reference/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,%20java.lang.String,%20java.util.Set%3Cjava.lang.String%3E,%20androidx.webkit.WebViewCompat.WebMessageListener)))
///- iOS ///- iOS
///- MacOS
Future<void> addWebMessageListener( Future<void> addWebMessageListener(
WebMessageListener webMessageListener) async { WebMessageListener webMessageListener) async {
assert( assert(
@ -3107,9 +3217,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<bool> canScrollVertically() async { Future<bool> canScrollVertically() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -3120,9 +3233,12 @@ class InAppWebViewController {
/// ///
///**NOTE for Web**: this method will have effect only if the iframe has the same origin. ///**NOTE for Web**: this method will have effect only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: it is implemented using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
Future<bool> canScrollHorizontally() async { Future<bool> canScrollHorizontally() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -3233,6 +3349,7 @@ class InAppWebViewController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.reloadFromOrigin](https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin)) ///- iOS ([Official API - WKWebView.reloadFromOrigin](https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin))
///- MacOS ([Official API - WKWebView.reloadFromOrigin](https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin))
Future<void> reloadFromOrigin() async { Future<void> reloadFromOrigin() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('reloadFromOrigin', args); await _channel.invokeMethod('reloadFromOrigin', args);
@ -3245,8 +3362,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available only on iOS 14.0+. ///**NOTE for iOS**: available only on iOS 14.0+.
/// ///
///**NOTE for MacOS**: available only on MacOS 11.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf)) ///- iOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf))
///- MacOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf))
Future<Uint8List?> createPdf( Future<Uint8List?> createPdf(
{@Deprecated("Use pdfConfiguration instead") {@Deprecated("Use pdfConfiguration instead")
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
@ -3263,8 +3383,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available only on iOS 14.0+. ///**NOTE for iOS**: available only on iOS 14.0+.
/// ///
///**NOTE for MacOS**: available only on MacOS 11.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.createWebArchiveData](https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata)) ///- iOS ([Official API - WKWebView.createWebArchiveData](https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata))
///- MacOS ([Official API - WKWebView.createWebArchiveData](https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata))
Future<Uint8List?> createWebArchiveData() async { Future<Uint8List?> createWebArchiveData() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('createWebArchiveData', args); return await _channel.invokeMethod('createWebArchiveData', args);
@ -3274,6 +3397,7 @@ class InAppWebViewController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.hasOnlySecureContent](https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent)) ///- iOS ([Official API - WKWebView.hasOnlySecureContent](https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent))
///- MacOS ([Official API - WKWebView.hasOnlySecureContent](https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent))
Future<bool> hasOnlySecureContent() async { Future<bool> hasOnlySecureContent() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('hasOnlySecureContent', args); return await _channel.invokeMethod('hasOnlySecureContent', args);
@ -3283,8 +3407,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.pauseAllMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback)). ///- iOS ([Official API - WKWebView.pauseAllMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback)).
///- MacOS ([Official API - WKWebView.pauseAllMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback)).
Future<void> pauseAllMediaPlayback() async { Future<void> pauseAllMediaPlayback() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('pauseAllMediaPlayback', args); return await _channel.invokeMethod('pauseAllMediaPlayback', args);
@ -3297,8 +3424,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.setAllMediaPlaybackSuspended](https://developer.apple.com/documentation/webkit/wkwebview/3752242-setallmediaplaybacksuspended)). ///- iOS ([Official API - WKWebView.setAllMediaPlaybackSuspended](https://developer.apple.com/documentation/webkit/wkwebview/3752242-setallmediaplaybacksuspended)).
///- MacOS ([Official API - WKWebView.setAllMediaPlaybackSuspended](https://developer.apple.com/documentation/webkit/wkwebview/3752242-setallmediaplaybacksuspended)).
Future<void> setAllMediaPlaybackSuspended({required bool suspended}) async { Future<void> setAllMediaPlaybackSuspended({required bool suspended}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("suspended", () => suspended); args.putIfAbsent("suspended", () => suspended);
@ -3309,8 +3439,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 14.5+. ///**NOTE for iOS**: available on iOS 14.5+.
/// ///
///**NOTE for MacOS**: available on MacOS 11.3+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.closeAllMediaPresentations](https://developer.apple.com/documentation/webkit/wkwebview/3752235-closeallmediapresentations)). ///- iOS ([Official API - WKWebView.closeAllMediaPresentations](https://developer.apple.com/documentation/webkit/wkwebview/3752235-closeallmediapresentations)).
///- MacOS ([Official API - WKWebView.closeAllMediaPresentations](https://developer.apple.com/documentation/webkit/wkwebview/3752235-closeallmediapresentations)).
Future<void> closeAllMediaPresentations() async { Future<void> closeAllMediaPresentations() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('closeAllMediaPresentations', args); return await _channel.invokeMethod('closeAllMediaPresentations', args);
@ -3322,8 +3455,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.requestMediaPlaybackState](https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate)). ///- iOS ([Official API - WKWebView.requestMediaPlaybackState](https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate)).
///- MacOS ([Official API - WKWebView.requestMediaPlaybackState](https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate)).
Future<MediaPlaybackState?> requestMediaPlaybackState() async { Future<MediaPlaybackState?> requestMediaPlaybackState() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return MediaPlaybackState.fromNativeValue( return MediaPlaybackState.fromNativeValue(
@ -3335,6 +3471,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
Future<bool> isInFullscreen() async { Future<bool> isInFullscreen() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('isInFullscreen', args); return await _channel.invokeMethod('isInFullscreen', args);
@ -3344,8 +3481,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.cameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763093-cameracapturestate)). ///- iOS ([Official API - WKWebView.cameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763093-cameracapturestate)).
///- MacOS ([Official API - WKWebView.cameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763093-cameracapturestate)).
Future<MediaCaptureState?> getCameraCaptureState() async { Future<MediaCaptureState?> getCameraCaptureState() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return MediaCaptureState.fromNativeValue( return MediaCaptureState.fromNativeValue(
@ -3356,8 +3496,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)). ///- iOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)).
///- MacOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)).
Future<void> setCameraCaptureState({required MediaCaptureState state}) async { Future<void> setCameraCaptureState({required MediaCaptureState state}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('state', () => state.toNativeValue()); args.putIfAbsent('state', () => state.toNativeValue());
@ -3368,8 +3511,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.microphoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763096-microphonecapturestate)). ///- iOS ([Official API - WKWebView.microphoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763096-microphonecapturestate)).
///- MacOS ([Official API - WKWebView.microphoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763096-microphonecapturestate)).
Future<MediaCaptureState?> getMicrophoneCaptureState() async { Future<MediaCaptureState?> getMicrophoneCaptureState() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return MediaCaptureState.fromNativeValue( return MediaCaptureState.fromNativeValue(
@ -3380,8 +3526,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.setMicrophoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763098-setmicrophonecapturestate)). ///- iOS ([Official API - WKWebView.setMicrophoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763098-setmicrophonecapturestate)).
///- MacOS ([Official API - WKWebView.setMicrophoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763098-setmicrophonecapturestate)).
Future<void> setMicrophoneCaptureState( Future<void> setMicrophoneCaptureState(
{required MediaCaptureState state}) async { {required MediaCaptureState state}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -3409,8 +3558,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available on iOS 15.0+. ///**NOTE for iOS**: available on iOS 15.0+.
/// ///
///**NOTE for MacOS**: available on MacOS 12.0+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)](https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest) and [Official API - WKWebView.loadSimulatedRequest(_:responseHTML:)](https://developer.apple.com/documentation/webkit/wkwebview/3763095-loadsimulatedrequest)). ///- iOS ([Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)](https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest) and [Official API - WKWebView.loadSimulatedRequest(_:responseHTML:)](https://developer.apple.com/documentation/webkit/wkwebview/3763095-loadsimulatedrequest)).
///- MacOS ([Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)](https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest) and [Official API - WKWebView.loadSimulatedRequest(_:responseHTML:)](https://developer.apple.com/documentation/webkit/wkwebview/3763095-loadsimulatedrequest)).
Future<void> loadSimulatedRequest( Future<void> loadSimulatedRequest(
{required URLRequest urlRequest, {required URLRequest urlRequest,
required Uint8List data, required Uint8List data,
@ -3436,6 +3588,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebSettings.getDefaultUserAgent](https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context))) ///- Android native WebView ([Official API - WebSettings.getDefaultUserAgent](https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context)))
///- iOS ///- iOS
///- MacOS
static Future<String> getDefaultUserAgent() async { static Future<String> getDefaultUserAgent() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _staticChannel.invokeMethod('getDefaultUserAgent', args); return await _staticChannel.invokeMethod('getDefaultUserAgent', args);
@ -3545,8 +3698,11 @@ class InAppWebViewController {
/// ///
///**NOTE for iOS**: available only on iOS 11.0+. ///**NOTE for iOS**: available only on iOS 11.0+.
/// ///
///**NOTE for MacOS**: available only on MacOS 10.13+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebView.handlesURLScheme](https://developer.apple.com/documentation/webkit/wkwebview/2875370-handlesurlscheme)) ///- iOS ([Official API - WKWebView.handlesURLScheme](https://developer.apple.com/documentation/webkit/wkwebview/2875370-handlesurlscheme))
///- MacOS ([Official API - WKWebView.handlesURLScheme](https://developer.apple.com/documentation/webkit/wkwebview/2875370-handlesurlscheme))
static Future<bool> handlesURLScheme(String urlScheme) async { static Future<bool> handlesURLScheme(String urlScheme) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlScheme', () => urlScheme); args.putIfAbsent('urlScheme', () => urlScheme);
@ -3558,6 +3714,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
static Future<String> get tRexRunnerHtml async => await rootBundle.loadString( static Future<String> get tRexRunnerHtml async => await rootBundle.loadString(
'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html'); 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html');
@ -3566,6 +3723,7 @@ class InAppWebViewController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
static Future<String> get tRexRunnerCss async => await rootBundle.loadString( static Future<String> get tRexRunnerCss async => await rootBundle.loadString(
'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css'); 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css');

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,12 @@
export 'webview.dart'; export 'webview.dart';
export 'in_app_webview.dart'; export 'in_app_webview.dart';
export 'in_app_webview_controller.dart'; export 'in_app_webview_controller.dart';
export 'in_app_webview_settings.dart'; export 'in_app_webview_settings.dart'
show
InAppWebViewSettings,
InAppWebViewGroupOptions,
WebViewOptions,
InAppWebViewOptions;
export 'headless_in_app_webview.dart'; export 'headless_in_app_webview.dart';
export 'android/main.dart'; export 'android/main.dart';
export 'apple/main.dart'; export 'apple/main.dart';

View File

@ -36,6 +36,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final void Function(InAppWebViewController controller)? onWebViewCreated; final void Function(InAppWebViewController controller)? onWebViewCreated;
@ -49,6 +50,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap))) ///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- Web ///- Web
final void Function(InAppWebViewController controller, Uri? url)? onLoadStart; final void Function(InAppWebViewController controller, Uri? url)? onLoadStart;
@ -60,6 +62,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event)) ///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event))
final void Function(InAppWebViewController controller, Uri? url)? onLoadStop; final void Function(InAppWebViewController controller, Uri? url)? onLoadStop;
@ -73,6 +76,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError))) ///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
final void Function(InAppWebViewController controller, final void Function(InAppWebViewController controller,
WebResourceRequest request, WebResourceError error)? onReceivedError; WebResourceRequest request, WebResourceError error)? onReceivedError;
@ -92,6 +96,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse))) ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
final void Function( final void Function(
InAppWebViewController controller, InAppWebViewController controller,
WebResourceRequest request, WebResourceRequest request,
@ -102,6 +107,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int))) ///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)))
///- iOS ///- iOS
///- MacOS
final void Function(InAppWebViewController controller, int progress)? final void Function(InAppWebViewController controller, int progress)?
onProgressChanged; onProgressChanged;
@ -112,6 +118,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage))) ///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)))
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final void Function( final void Function(
InAppWebViewController controller, ConsoleMessage consoleMessage)? InAppWebViewController controller, ConsoleMessage consoleMessage)?
@ -120,30 +127,32 @@ abstract class WebView {
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView. ///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
/// ///
///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default. ///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default.
///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] option ///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] setting
///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled. ///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled.
/// ///
///Also, on Android, this method is not called for POST requests. ///Also, on Android, this method is not called for POST requests.
/// ///
///[navigationAction] represents an object that contains information about an action that causes navigation to occur. ///[navigationAction] represents an object that contains information about an action that causes navigation to occur.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] setting to `true`.
///Also, on Android this event is not called on the first page load. ///Also, on Android this event is not called on the first page load.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
final Future<NavigationActionPolicy?> Function( final Future<NavigationActionPolicy?> Function(
InAppWebViewController controller, NavigationAction navigationAction)? InAppWebViewController controller, NavigationAction navigationAction)?
shouldOverrideUrlLoading; shouldOverrideUrlLoading;
///Event fired when the [WebView] loads a resource. ///Event fired when the [WebView] loads a resource.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] options to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final void Function( final void Function(
InAppWebViewController controller, LoadedResource resource)? InAppWebViewController controller, LoadedResource resource)?
onLoadResource; onLoadResource;
@ -156,10 +165,13 @@ abstract class WebView {
/// ///
///**NOTE for Web**: this event will be called only if the iframe has the same origin. ///**NOTE for Web**: this event will be called only if the iframe has the same origin.
/// ///
///**NOTE for MacOS**: this method is implemented with using JavaScript.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int))) ///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)))
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll)) ///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll))
///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll)) ///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll))
///- MacOS
final void Function(InAppWebViewController controller, int x, int y)? final void Function(InAppWebViewController controller, int x, int y)?
onScrollChanged; onScrollChanged;
@ -173,11 +185,12 @@ abstract class WebView {
/// ///
///[downloadStartRequest] represents the request of the file to download. ///[downloadStartRequest] represents the request of the file to download.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener))) ///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)))
///- iOS ///- iOS
///- MacOS
final void Function(InAppWebViewController controller, final void Function(InAppWebViewController controller,
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest; DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@ -192,6 +205,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler)) ///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)? InAppWebViewController controller, WebResourceRequest request)?
onLoadResourceWithCustomScheme; onLoadResourceWithCustomScheme;
@ -204,12 +218,12 @@ abstract class WebView {
/// ///
///- [createWindowAction] represents the request. ///- [createWindowAction] represents the request.
/// ///
///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically] option to `true`. ///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically] setting to `true`.
/// ///
///**NOTE for Android**: you need to set [InAppWebViewSettings.supportMultipleWindows] option to `true`. ///**NOTE for Android**: you need to set [InAppWebViewSettings.supportMultipleWindows] setting to `true`.
///Also, if the request has been created using JavaScript (`window.open()`), then there are some limitation: check the [NavigationAction] class. ///Also, if the request has been created using JavaScript (`window.open()`), then there are some limitation: check the [NavigationAction] class.
/// ///
///**NOTE for iOS**: setting these initial options: [InAppWebViewSettings.supportZoom], [InAppWebViewSettings.useOnLoadResource], [InAppWebViewSettings.useShouldInterceptAjaxRequest], ///**NOTE for iOS and MacOS**: setting these initial options: [InAppWebViewSettings.supportZoom], [InAppWebViewSettings.useOnLoadResource], [InAppWebViewSettings.useShouldInterceptAjaxRequest],
///[InAppWebViewSettings.useShouldInterceptFetchRequest], [InAppWebViewSettings.applicationNameForUserAgent], [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically], ///[InAppWebViewSettings.useShouldInterceptFetchRequest], [InAppWebViewSettings.applicationNameForUserAgent], [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically],
///[InAppWebViewSettings.javaScriptEnabled], [InAppWebViewSettings.minimumFontSize], [InAppWebViewSettings.preferredContentMode], [InAppWebViewSettings.incognito], ///[InAppWebViewSettings.javaScriptEnabled], [InAppWebViewSettings.minimumFontSize], [InAppWebViewSettings.preferredContentMode], [InAppWebViewSettings.incognito],
///[InAppWebViewSettings.cacheEnabled], [InAppWebViewSettings.mediaPlaybackRequiresUserGesture], ///[InAppWebViewSettings.cacheEnabled], [InAppWebViewSettings.mediaPlaybackRequiresUserGesture],
@ -231,6 +245,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message))) ///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- Web ///- Web
final Future<bool?> Function(InAppWebViewController controller, final Future<bool?> Function(InAppWebViewController controller,
CreateWindowAction createWindowAction)? onCreateWindow; CreateWindowAction createWindowAction)? onCreateWindow;
@ -241,6 +256,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView))) ///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)))
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) ///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
final void Function(InAppWebViewController controller)? onCloseWindow; final void Function(InAppWebViewController controller)? onCloseWindow;
///Event fired when the JavaScript `window` object of the WebView has received focus. ///Event fired when the JavaScript `window` object of the WebView has received focus.
@ -251,6 +267,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)) ///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event))
final void Function(InAppWebViewController controller)? onWindowFocus; final void Function(InAppWebViewController controller)? onWindowFocus;
@ -262,6 +279,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event)) ///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event))
final void Function(InAppWebViewController controller)? onWindowBlur; final void Function(InAppWebViewController controller)? onWindowBlur;
@ -273,6 +291,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
final Future<JsAlertResponse?> Function( final Future<JsAlertResponse?> Function(
InAppWebViewController controller, JsAlertRequest jsAlertRequest)? InAppWebViewController controller, JsAlertRequest jsAlertRequest)?
onJsAlert; onJsAlert;
@ -285,6 +304,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
final Future<JsConfirmResponse?> Function( final Future<JsConfirmResponse?> Function(
InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)? InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
onJsConfirm; onJsConfirm;
@ -297,6 +317,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview)) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
final Future<JsPromptResponse?> Function( final Future<JsPromptResponse?> Function(
InAppWebViewController controller, JsPromptRequest jsPromptRequest)? InAppWebViewController controller, JsPromptRequest jsPromptRequest)?
onJsPrompt; onJsPrompt;
@ -308,6 +329,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
final Future<HttpAuthResponse?> Function(InAppWebViewController controller, final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest; HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
@ -319,6 +341,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError))) ///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
final Future<ServerTrustAuthResponse?> Function( final Future<ServerTrustAuthResponse?> Function(
InAppWebViewController controller, ServerTrustChallenge challenge)? InAppWebViewController controller, ServerTrustChallenge challenge)?
onReceivedServerTrustAuthRequest; onReceivedServerTrustAuthRequest;
@ -333,6 +356,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest))) ///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
final Future<ClientCertResponse?> Function( final Future<ClientCertResponse?> Function(
InAppWebViewController controller, ClientCertChallenge challenge)? InAppWebViewController controller, ClientCertChallenge challenge)?
onReceivedClientCertRequest; onReceivedClientCertRequest;
@ -347,7 +371,7 @@ abstract class WebView {
/// ///
///[ajaxRequest] represents the `XMLHttpRequest`. ///[ajaxRequest] represents the `XMLHttpRequest`.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -356,6 +380,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final Future<AjaxRequest?> Function( final Future<AjaxRequest?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)? InAppWebViewController controller, AjaxRequest ajaxRequest)?
shouldInterceptAjaxRequest; shouldInterceptAjaxRequest;
@ -365,7 +390,7 @@ abstract class WebView {
/// ///
///[ajaxRequest] represents the [XMLHttpRequest]. ///[ajaxRequest] represents the [XMLHttpRequest].
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -374,6 +399,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final Future<AjaxRequestAction?> Function( final Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)? InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxReadyStateChange; onAjaxReadyStateChange;
@ -383,7 +409,7 @@ abstract class WebView {
/// ///
///[ajaxRequest] represents the [XMLHttpRequest]. ///[ajaxRequest] represents the [XMLHttpRequest].
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -392,6 +418,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final Future<AjaxRequestAction?> Function( final Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)? InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxProgress; onAjaxProgress;
@ -401,7 +428,7 @@ abstract class WebView {
/// ///
///[fetchRequest] represents a resource request. ///[fetchRequest] represents a resource request.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptFetchRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptFetchRequest] setting to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that ///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code ///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
@ -410,6 +437,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final Future<FetchRequest?> Function( final Future<FetchRequest?> Function(
InAppWebViewController controller, FetchRequest fetchRequest)? InAppWebViewController controller, FetchRequest fetchRequest)?
shouldInterceptFetchRequest; shouldInterceptFetchRequest;
@ -428,6 +456,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean))) ///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)))
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final void Function( final void Function(
InAppWebViewController controller, Uri? url, bool? isReload)? InAppWebViewController controller, Uri? url, bool? isReload)?
@ -451,6 +480,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final Future<bool?> Function(InAppWebViewController controller, Uri? url, final Future<bool?> Function(InAppWebViewController controller, Uri? url,
PrintJobController? printJobController)? onPrintRequest; PrintJobController? printJobController)? onPrintRequest;
@ -470,6 +500,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback))) ///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback)))
///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification)) ///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification))
///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event)) ///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
final void Function(InAppWebViewController controller)? onEnterFullscreen; final void Function(InAppWebViewController controller)? onEnterFullscreen;
@ -482,6 +513,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView())) ///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()))
///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification)) ///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification))
///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event)) ///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
final void Function(InAppWebViewController controller)? onExitFullscreen; final void Function(InAppWebViewController controller)? onExitFullscreen;
@ -495,6 +527,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
final void Function(InAppWebViewController controller, Uri? url)? final void Function(InAppWebViewController controller, Uri? url)?
onPageCommitVisible; onPageCommitVisible;
@ -507,6 +540,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String))) ///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)))
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final void Function(InAppWebViewController controller, String? title)? final void Function(InAppWebViewController controller, String? title)?
onTitleChanged; onTitleChanged;
@ -583,9 +617,12 @@ abstract class WebView {
/// ///
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT]. ///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
/// ///
///**NOTE for MacOS**: available only on iOS 12.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest))) ///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)))
///- iOS ///- iOS
///- MacOS
final Future<PermissionResponse?> Function(InAppWebViewController controller, final Future<PermissionResponse?> Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequest; PermissionRequest permissionRequest)? onPermissionRequest;
@ -812,6 +849,7 @@ abstract class WebView {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) ///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
final void Function(InAppWebViewController controller)? final void Function(InAppWebViewController controller)?
onWebContentProcessDidTerminate; onWebContentProcessDidTerminate;
@ -824,6 +862,7 @@ abstract class WebView {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
final void Function(InAppWebViewController controller)? final void Function(InAppWebViewController controller)?
onDidReceiveServerRedirectForProvisionalNavigation; onDidReceiveServerRedirectForProvisionalNavigation;
@ -837,10 +876,11 @@ abstract class WebView {
/// ///
///[navigationResponse] represents the navigation response. ///[navigationResponse] represents the navigation response.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] setting to `true`.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
final Future<NavigationResponseAction?> Function( final Future<NavigationResponseAction?> Function(
InAppWebViewController controller, InAppWebViewController controller,
NavigationResponse navigationResponse)? onNavigationResponse; NavigationResponse navigationResponse)? onNavigationResponse;
@ -855,20 +895,26 @@ abstract class WebView {
/// ///
///[challenge] represents the authentication challenge. ///[challenge] represents the authentication challenge.
/// ///
///**NOTE**: available only on iOS 14.0+. ///**NOTE for iOS**: available only on iOS 14.0+.
///
///**NOTE for MacOS**: available only on MacOS 11.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
final Future<ShouldAllowDeprecatedTLSAction?> Function( final Future<ShouldAllowDeprecatedTLSAction?> Function(
InAppWebViewController controller, InAppWebViewController controller,
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
///Event fired when a change in the camera capture state occurred. ///Event fired when a change in the camera capture state occurred.
/// ///
///**NOTE**: available only on iOS 15.0+. ///**NOTE for iOS**: available only on iOS 15.0+.
///
///**NOTE for MacOS**: available only on MacOS 12.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
final Future<void> Function( final Future<void> Function(
InAppWebViewController controller, InAppWebViewController controller,
MediaCaptureState? oldState, MediaCaptureState? oldState,
@ -877,10 +923,13 @@ abstract class WebView {
///Event fired when a change in the microphone capture state occurred. ///Event fired when a change in the microphone capture state occurred.
/// ///
///**NOTE**: available only on iOS 15.0+. ///**NOTE for iOS**: available only on iOS 15.0+.
///
///**NOTE for MacOS**: available only on MacOS 12.0+.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
final Future<void> Function( final Future<void> Function(
InAppWebViewController controller, InAppWebViewController controller,
MediaCaptureState? oldState, MediaCaptureState? oldState,
@ -894,6 +943,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final URLRequest? initialUrlRequest; final URLRequest? initialUrlRequest;
@ -902,6 +952,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final String? initialFile; final String? initialFile;
@ -910,6 +961,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final InAppWebViewInitialData? initialData; final InAppWebViewInitialData? initialData;
@ -922,6 +974,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
final InAppWebViewSettings? initialSettings; final InAppWebViewSettings? initialSettings;
@ -943,6 +996,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final UnmodifiableListView<UserScript>? initialUserScripts; final UnmodifiableListView<UserScript>? initialUserScripts;
///Represents the pull-to-refresh feature controller. ///Represents the pull-to-refresh feature controller.
@ -959,6 +1013,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
final FindInteractionController? findInteractionController; final FindInteractionController? findInteractionController;
///Represents the WebView native implementation to be used. ///Represents the WebView native implementation to be used.

View File

@ -8,6 +8,11 @@ typedef PrintJobCompletionHandler = Future<void> Function(
bool completed, String? error)?; bool completed, String? error)?;
///Class representing a print job eventually returned by [InAppWebViewController.printCurrentPage]. ///Class representing a print job eventually returned by [InAppWebViewController.printCurrentPage].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
class PrintJobController implements Disposable { class PrintJobController implements Disposable {
///Print job ID. ///Print job ID.
final String id; final String id;
@ -18,6 +23,7 @@ class PrintJobController implements Disposable {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - UIPrintInteractionController.CompletionHandler](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/completionhandler)) ///- iOS ([Official API - UIPrintInteractionController.CompletionHandler](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/completionhandler))
///- MacOS ([Official API - NSPrintOperation.runModal](https://developer.apple.com/documentation/appkit/nsprintoperation/1532065-runmodal))
PrintJobCompletionHandler onComplete; PrintJobCompletionHandler onComplete;
PrintJobController({required this.id}) { PrintJobController({required this.id}) {
@ -91,6 +97,7 @@ class PrintJobController implements Disposable {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PrintJob.getInfo](https://developer.android.com/reference/android/print/PrintJob#getInfo())) ///- Android native WebView ([Official API - PrintJob.getInfo](https://developer.android.com/reference/android/print/PrintJob#getInfo()))
///- iOS ///- iOS
///- MacOS
Future<PrintJobInfo?> getInfo() async { Future<PrintJobInfo?> getInfo() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? infoMap = Map<String, dynamic>? infoMap =
@ -103,6 +110,7 @@ class PrintJobController implements Disposable {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
@override @override
Future<void> dispose() async { Future<void> dispose() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};

View File

@ -22,6 +22,12 @@ class PermissionResourceType_ {
EnumIOSPlatform( EnumIOSPlatform(
available: "15.0", available: "15.0",
apiName: 'WKMediaCaptureType.microphone', apiName: 'WKMediaCaptureType.microphone',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone',
value: 1),
EnumMacOSPlatform(
available: "12.0",
apiName: 'WKMediaCaptureType.microphone',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone', 'https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone',
value: 1) value: 1)
@ -61,6 +67,12 @@ class PermissionResourceType_ {
EnumIOSPlatform( EnumIOSPlatform(
available: "15.0", available: "15.0",
apiName: 'WKMediaCaptureType.camera', apiName: 'WKMediaCaptureType.camera',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera',
value: 0),
EnumMacOSPlatform(
available: "12.0",
apiName: 'WKMediaCaptureType.camera',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera', 'https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera',
value: 0) value: 0)
@ -72,6 +84,12 @@ class PermissionResourceType_ {
EnumIOSPlatform( EnumIOSPlatform(
available: "15.0", available: "15.0",
apiName: 'WKMediaCaptureType.cameraAndMicrophone', apiName: 'WKMediaCaptureType.cameraAndMicrophone',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone',
value: 2),
EnumMacOSPlatform(
available: "12.0",
apiName: 'WKMediaCaptureType.cameraAndMicrophone',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone', 'https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone',
value: 2) value: 2)
@ -81,7 +99,8 @@ class PermissionResourceType_ {
///Resource belongs to the devices orientation and motion. ///Resource belongs to the devices orientation and motion.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(available: "15.0", value: 'deviceOrientationAndMotion') EnumIOSPlatform(available: "15.0", value: 'deviceOrientationAndMotion'),
EnumMacOSPlatform(available: "12.0", value: 'deviceOrientationAndMotion')
]) ])
static const DEVICE_ORIENTATION_AND_MOTION = static const DEVICE_ORIENTATION_AND_MOTION =
PermissionResourceType_._internal('DEVICE_ORIENTATION_AND_MOTION'); PermissionResourceType_._internal('DEVICE_ORIENTATION_AND_MOTION');

View File

@ -21,6 +21,7 @@ class PermissionResourceType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE)) ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE))
///- iOS 15.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone)) ///- iOS 15.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
///- MacOS 12.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
static final MICROPHONE = static final MICROPHONE =
PermissionResourceType._internalMultiPlatform('MICROPHONE', () { PermissionResourceType._internalMultiPlatform('MICROPHONE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -28,6 +29,8 @@ class PermissionResourceType {
return 'android.webkit.resource.AUDIO_CAPTURE'; return 'android.webkit.resource.AUDIO_CAPTURE';
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 1; return 1;
case TargetPlatform.macOS:
return 1;
default: default:
break; break;
} }
@ -71,6 +74,7 @@ class PermissionResourceType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_VIDEO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_VIDEO_CAPTURE)) ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_VIDEO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_VIDEO_CAPTURE))
///- iOS 15.0+ ([Official API - WKMediaCaptureType.camera](https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera)) ///- iOS 15.0+ ([Official API - WKMediaCaptureType.camera](https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera))
///- MacOS 12.0+ ([Official API - WKMediaCaptureType.camera](https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera))
static final CAMERA = static final CAMERA =
PermissionResourceType._internalMultiPlatform('CAMERA', () { PermissionResourceType._internalMultiPlatform('CAMERA', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -78,6 +82,8 @@ class PermissionResourceType {
return 'android.webkit.resource.VIDEO_CAPTURE'; return 'android.webkit.resource.VIDEO_CAPTURE';
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 0; return 0;
case TargetPlatform.macOS:
return 0;
default: default:
break; break;
} }
@ -88,12 +94,15 @@ class PermissionResourceType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS 15.0+ ([Official API - WKMediaCaptureType.cameraAndMicrophone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone)) ///- iOS 15.0+ ([Official API - WKMediaCaptureType.cameraAndMicrophone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone))
///- MacOS 12.0+ ([Official API - WKMediaCaptureType.cameraAndMicrophone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone))
static final CAMERA_AND_MICROPHONE = static final CAMERA_AND_MICROPHONE =
PermissionResourceType._internalMultiPlatform('CAMERA_AND_MICROPHONE', PermissionResourceType._internalMultiPlatform('CAMERA_AND_MICROPHONE',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 2; return 2;
case TargetPlatform.macOS:
return 2;
default: default:
break; break;
} }
@ -104,12 +113,15 @@ class PermissionResourceType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS 15.0+ ///- iOS 15.0+
///- MacOS 12.0+
static final DEVICE_ORIENTATION_AND_MOTION = static final DEVICE_ORIENTATION_AND_MOTION =
PermissionResourceType._internalMultiPlatform( PermissionResourceType._internalMultiPlatform(
'DEVICE_ORIENTATION_AND_MOTION', () { 'DEVICE_ORIENTATION_AND_MOTION', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 'deviceOrientationAndMotion'; return 'deviceOrientationAndMotion';
case TargetPlatform.macOS:
return 'deviceOrientationAndMotion';
default: default:
break; break;
} }

View File

@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart'; import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'permission_response.dart'; import 'permission_response.dart';
@ -19,12 +18,6 @@ class PermissionResponseAction_ {
static const GRANT = const PermissionResponseAction_._internal(1); static const GRANT = const PermissionResponseAction_._internal(1);
///Prompt the user for permission for the requested resource. ///Prompt the user for permission for the requested resource.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
available: "15.0",
note: "On iOS < 15.0, it will fallback to [DENY]",
value: 2)
])
static const PROMPT = const PermissionResponseAction_._internal(2); static const PROMPT = const PermissionResponseAction_._internal(2);
} }

View File

@ -23,20 +23,7 @@ class PermissionResponseAction {
static const GRANT = PermissionResponseAction._internal(1, 1); static const GRANT = PermissionResponseAction._internal(1, 1);
///Prompt the user for permission for the requested resource. ///Prompt the user for permission for the requested resource.
/// static const PROMPT = PermissionResponseAction._internal(2, 2);
///**NOTE for iOS**: On iOS < 15.0, it will fallback to [DENY]
///
///**Supported Platforms/Implementations**:
///- iOS 15.0+
static final PROMPT = PermissionResponseAction._internalMultiPlatform(2, () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 2;
default:
break;
}
return null;
});
///Set of all values of [PermissionResponseAction]. ///Set of all values of [PermissionResponseAction].
static final Set<PermissionResponseAction> values = [ static final Set<PermissionResponseAction> values = [

View File

@ -74,6 +74,11 @@ class SslErrorType_ {
'https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID', 'https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID',
value: 5), value: 5),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.invalid',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/invalid',
value: 0),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.invalid', apiName: 'SecTrustResultType.invalid',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/invalid', 'https://developer.apple.com/documentation/security/sectrustresulttype/invalid',
@ -89,6 +94,11 @@ class SslErrorType_ {
///The Keychain Access utility refers to this value as "Never Trust." ///The Keychain Access utility refers to this value as "Never Trust."
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.deny',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/deny',
value: 3),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.deny', apiName: 'SecTrustResultType.deny',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/deny', 'https://developer.apple.com/documentation/security/sectrustresulttype/deny',
@ -106,6 +116,11 @@ class SslErrorType_ {
///When receiving this value, most apps should trust the chain. ///When receiving this value, most apps should trust the chain.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.unspecified',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/unspecified',
value: 4),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.unspecified', apiName: 'SecTrustResultType.unspecified',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/unspecified', 'https://developer.apple.com/documentation/security/sectrustresulttype/unspecified',
@ -124,6 +139,11 @@ class SslErrorType_ {
///you should check again using that date to see if the message was valid when you originally received it. ///you should check again using that date to see if the message was valid when you originally received it.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.recoverableTrustFailure',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure',
value: 5),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.recoverableTrustFailure', apiName: 'SecTrustResultType.recoverableTrustFailure',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure', 'https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure',
@ -140,6 +160,11 @@ class SslErrorType_ {
///Changing parameter values and reevaluating is unlikely to succeed unless you provide different certificates. ///Changing parameter values and reevaluating is unlikely to succeed unless you provide different certificates.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.fatalTrustFailure',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure',
value: 6),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.fatalTrustFailure', apiName: 'SecTrustResultType.fatalTrustFailure',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure', 'https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure',
@ -154,6 +179,11 @@ class SslErrorType_ {
///This can be caused by either a revoked certificate or by OS-level errors that are unrelated to the certificates themselves. ///This can be caused by either a revoked certificate or by OS-level errors that are unrelated to the certificates themselves.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'SecTrustResultType.otherError',
apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/othererror',
value: 7),
EnumMacOSPlatform(
apiName: 'SecTrustResultType.otherError', apiName: 'SecTrustResultType.otherError',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/security/sectrustresulttype/othererror', 'https://developer.apple.com/documentation/security/sectrustresulttype/othererror',

View File

@ -95,12 +95,15 @@ class SslErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID)) ///- Android native WebView ([Official API - SslError.SSL_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID))
///- iOS ([Official API - SecTrustResultType.invalid](https://developer.apple.com/documentation/security/sectrustresulttype/invalid)) ///- iOS ([Official API - SecTrustResultType.invalid](https://developer.apple.com/documentation/security/sectrustresulttype/invalid))
///- MacOS ([Official API - SecTrustResultType.invalid](https://developer.apple.com/documentation/security/sectrustresulttype/invalid))
static final INVALID = SslErrorType._internalMultiPlatform('INVALID', () { static final INVALID = SslErrorType._internalMultiPlatform('INVALID', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
return 5; return 5;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 0; return 0;
case TargetPlatform.macOS:
return 0;
default: default:
break; break;
} }
@ -116,10 +119,13 @@ class SslErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny)) ///- iOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny))
///- MacOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny))
static final DENY = SslErrorType._internalMultiPlatform('DENY', () { static final DENY = SslErrorType._internalMultiPlatform('DENY', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 3; return 3;
case TargetPlatform.macOS:
return 3;
default: default:
break; break;
} }
@ -137,11 +143,14 @@ class SslErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified)) ///- iOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified))
///- MacOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified))
static final UNSPECIFIED = static final UNSPECIFIED =
SslErrorType._internalMultiPlatform('UNSPECIFIED', () { SslErrorType._internalMultiPlatform('UNSPECIFIED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 4; return 4;
case TargetPlatform.macOS:
return 4;
default: default:
break; break;
} }
@ -160,11 +169,14 @@ class SslErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure)) ///- iOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure))
///- MacOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure))
static final RECOVERABLE_TRUST_FAILURE = static final RECOVERABLE_TRUST_FAILURE =
SslErrorType._internalMultiPlatform('RECOVERABLE_TRUST_FAILURE', () { SslErrorType._internalMultiPlatform('RECOVERABLE_TRUST_FAILURE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 5; return 5;
case TargetPlatform.macOS:
return 5;
default: default:
break; break;
} }
@ -180,11 +192,14 @@ class SslErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure)) ///- iOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure))
///- MacOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure))
static final FATAL_TRUST_FAILURE = static final FATAL_TRUST_FAILURE =
SslErrorType._internalMultiPlatform('FATAL_TRUST_FAILURE', () { SslErrorType._internalMultiPlatform('FATAL_TRUST_FAILURE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 6; return 6;
case TargetPlatform.macOS:
return 6;
default: default:
break; break;
} }
@ -198,11 +213,14 @@ class SslErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror)) ///- iOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror))
///- MacOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror))
static final OTHER_ERROR = static final OTHER_ERROR =
SslErrorType._internalMultiPlatform('OTHER_ERROR', () { SslErrorType._internalMultiPlatform('OTHER_ERROR', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 7; return 7;
case TargetPlatform.macOS:
return 7;
default: default:
break; break;
} }

View File

@ -32,6 +32,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_BAD_URL', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_BAD_URL',
value: -12), value: -12),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.badURL',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl',
value: -1000),
EnumMacOSPlatform(
apiName: 'URLError.badURL', apiName: 'URLError.badURL',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl', 'https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl',
@ -47,6 +52,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_CONNECT', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_CONNECT',
value: -6), value: -6),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotConnectToHost',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost',
value: -1004),
EnumMacOSPlatform(
apiName: 'URLError.cannotConnectToHost', apiName: 'URLError.cannotConnectToHost',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost',
@ -85,6 +95,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_FILE_NOT_FOUND', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_FILE_NOT_FOUND',
value: -14), value: -14),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.fileDoesNotExist',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist',
value: -1100),
EnumMacOSPlatform(
apiName: 'URLError.fileDoesNotExist', apiName: 'URLError.fileDoesNotExist',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist',
@ -101,6 +116,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_HOST_LOOKUP', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_HOST_LOOKUP',
value: -2), value: -2),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotFindHost',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost',
value: -1003),
EnumMacOSPlatform(
apiName: 'URLError.cannotFindHost', apiName: 'URLError.cannotFindHost',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost',
@ -137,6 +157,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_REDIRECT_LOOP', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_REDIRECT_LOOP',
value: -9), value: -9),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.httpTooManyRedirects',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects',
value: -1007),
EnumMacOSPlatform(
apiName: 'URLError.httpTooManyRedirects', apiName: 'URLError.httpTooManyRedirects',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects',
@ -153,6 +178,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_TIMEOUT', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_TIMEOUT',
value: -8), value: -8),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.timedOut',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout',
value: -1001),
EnumMacOSPlatform(
apiName: 'URLError.timedOut', apiName: 'URLError.timedOut',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout',
@ -179,6 +209,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNKNOWN', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNKNOWN',
value: -1), value: -1),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.unknown',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown',
value: -1),
EnumMacOSPlatform(
apiName: 'URLError.unknown', apiName: 'URLError.unknown',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown', 'https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown',
@ -217,6 +252,11 @@ class WebResourceErrorType_ {
'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNSUPPORTED_SCHEME', 'https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNSUPPORTED_SCHEME',
value: -10), value: -10),
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.unsupportedURL',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl',
value: -1002),
EnumMacOSPlatform(
apiName: 'URLError.unsupportedURL', apiName: 'URLError.unsupportedURL',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl',
@ -228,6 +268,11 @@ class WebResourceErrorType_ {
///An asynchronous load has been canceled. ///An asynchronous load has been canceled.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cancelled',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled',
value: -999),
EnumMacOSPlatform(
apiName: 'URLError.cancelled', apiName: 'URLError.cancelled',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled',
@ -238,6 +283,11 @@ class WebResourceErrorType_ {
///A client or server connection was severed in the middle of an in-progress load. ///A client or server connection was severed in the middle of an in-progress load.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.networkConnectionLost',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost',
value: -1005),
EnumMacOSPlatform(
apiName: 'URLError.networkConnectionLost', apiName: 'URLError.networkConnectionLost',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost', 'https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost',
@ -250,6 +300,11 @@ class WebResourceErrorType_ {
///This error can indicate a file-not-found situation, or decoding problems that prevent data from being processed correctly. ///This error can indicate a file-not-found situation, or decoding problems that prevent data from being processed correctly.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.resourceUnavailable',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable',
value: -1008),
EnumMacOSPlatform(
apiName: 'URLError.resourceUnavailable', apiName: 'URLError.resourceUnavailable',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable', 'https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable',
@ -261,6 +316,11 @@ class WebResourceErrorType_ {
///A network resource was requested, but an internet connection hasnt been established and cant be established automatically. ///A network resource was requested, but an internet connection hasnt been established and cant be established automatically.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.notConnectedToInternet',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet',
value: -1009),
EnumMacOSPlatform(
apiName: 'URLError.notConnectedToInternet', apiName: 'URLError.notConnectedToInternet',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet', 'https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet',
@ -272,6 +332,11 @@ class WebResourceErrorType_ {
///A redirect was specified by way of server response code, but the server didnt accompany this code with a redirect URL. ///A redirect was specified by way of server response code, but the server didnt accompany this code with a redirect URL.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.redirectToNonExistentLocation',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation',
value: -1010),
EnumMacOSPlatform(
apiName: 'URLError.redirectToNonExistentLocation', apiName: 'URLError.redirectToNonExistentLocation',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation', 'https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation',
@ -283,6 +348,11 @@ class WebResourceErrorType_ {
///The URL Loading System received bad data from the server. ///The URL Loading System received bad data from the server.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.badServerResponse',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse',
value: -1011),
EnumMacOSPlatform(
apiName: 'URLError.badServerResponse', apiName: 'URLError.badServerResponse',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse', 'https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse',
@ -295,6 +365,11 @@ class WebResourceErrorType_ {
///This error typically occurs when a user clicks a "Cancel" button in a username/password dialog, rather than attempting to authenticate. ///This error typically occurs when a user clicks a "Cancel" button in a username/password dialog, rather than attempting to authenticate.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.userCancelledAuthentication',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication',
value: -1012),
EnumMacOSPlatform(
apiName: 'URLError.userCancelledAuthentication', apiName: 'URLError.userCancelledAuthentication',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication', 'https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication',
@ -306,6 +381,11 @@ class WebResourceErrorType_ {
///Authentication is required to access a resource. ///Authentication is required to access a resource.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.userAuthenticationRequired',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired',
value: -1013),
EnumMacOSPlatform(
apiName: 'URLError.userAuthenticationRequired', apiName: 'URLError.userAuthenticationRequired',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired', 'https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired',
@ -317,6 +397,11 @@ class WebResourceErrorType_ {
///A server reported that a URL has a non-zero content length, but terminated the network connection gracefully without sending any data. ///A server reported that a URL has a non-zero content length, but terminated the network connection gracefully without sending any data.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.zeroByteResource',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource',
value: -1014),
EnumMacOSPlatform(
apiName: 'URLError.zeroByteResource', apiName: 'URLError.zeroByteResource',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource', 'https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource',
@ -328,6 +413,11 @@ class WebResourceErrorType_ {
///Content data received during a connection request couldnt be decoded for a known content encoding. ///Content data received during a connection request couldnt be decoded for a known content encoding.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotDecodeRawData',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata',
value: -1015),
EnumMacOSPlatform(
apiName: 'URLError.cannotDecodeRawData', apiName: 'URLError.cannotDecodeRawData',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata', 'https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata',
@ -339,6 +429,11 @@ class WebResourceErrorType_ {
///Content data received during a connection request couldnt be decoded for a known content encoding. ///Content data received during a connection request couldnt be decoded for a known content encoding.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotDecodeContentData',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata',
value: -1016),
EnumMacOSPlatform(
apiName: 'URLError.cannotDecodeContentData', apiName: 'URLError.cannotDecodeContentData',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata', 'https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata',
@ -350,6 +445,11 @@ class WebResourceErrorType_ {
///A task could not parse a response. ///A task could not parse a response.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotParseResponse',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse',
value: -1017),
EnumMacOSPlatform(
apiName: 'URLError.cannotParseResponse', apiName: 'URLError.cannotParseResponse',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse',
@ -364,6 +464,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu)) ///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.appTransportSecurityRequiresSecureConnection',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu',
value: -1022),
EnumMacOSPlatform(
apiName: 'URLError.appTransportSecurityRequiresSecureConnection', apiName: 'URLError.appTransportSecurityRequiresSecureConnection',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu',
@ -376,6 +481,11 @@ class WebResourceErrorType_ {
///A request for an FTP file resulted in the server responding that the file is not a plain file, but a directory. ///A request for an FTP file resulted in the server responding that the file is not a plain file, but a directory.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.fileIsDirectory',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory',
value: -1101),
EnumMacOSPlatform(
apiName: 'URLError.fileIsDirectory', apiName: 'URLError.fileIsDirectory',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory',
@ -387,6 +497,11 @@ class WebResourceErrorType_ {
///A resource couldnt be read because of insufficient permissions. ///A resource couldnt be read because of insufficient permissions.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.noPermissionsToReadFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile',
value: -1102),
EnumMacOSPlatform(
apiName: 'URLError.noPermissionsToReadFile', apiName: 'URLError.noPermissionsToReadFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile',
@ -398,6 +513,11 @@ class WebResourceErrorType_ {
///The length of the resource data exceeds the maximum allowed. ///The length of the resource data exceeds the maximum allowed.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.dataLengthExceedsMaximum',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum',
value: -1103),
EnumMacOSPlatform(
apiName: 'URLError.dataLengthExceedsMaximum', apiName: 'URLError.dataLengthExceedsMaximum',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum',
@ -409,6 +529,11 @@ class WebResourceErrorType_ {
///An attempt to establish a secure connection failed for reasons that cant be expressed more specifically. ///An attempt to establish a secure connection failed for reasons that cant be expressed more specifically.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.secureConnectionFailed',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed',
value: -1200),
EnumMacOSPlatform(
apiName: 'URLError.secureConnectionFailed', apiName: 'URLError.secureConnectionFailed',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed',
@ -420,6 +545,11 @@ class WebResourceErrorType_ {
///A server certificate had a date which indicates it has expired, or is not yet valid. ///A server certificate had a date which indicates it has expired, or is not yet valid.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.serverCertificateHasBadDate',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate',
value: -1201),
EnumMacOSPlatform(
apiName: 'URLError.serverCertificateHasBadDate', apiName: 'URLError.serverCertificateHasBadDate',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate',
@ -431,6 +561,11 @@ class WebResourceErrorType_ {
///A server certificate was signed by a root server that isnt trusted. ///A server certificate was signed by a root server that isnt trusted.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.serverCertificateUntrusted',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted',
value: -1202),
EnumMacOSPlatform(
apiName: 'URLError.serverCertificateUntrusted', apiName: 'URLError.serverCertificateUntrusted',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted',
@ -445,6 +580,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot)) ///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.serverCertificateHasUnknownRoot',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot',
value: -1203),
EnumMacOSPlatform(
apiName: 'URLError.serverCertificateHasUnknownRoot', apiName: 'URLError.serverCertificateHasUnknownRoot',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot',
@ -459,6 +599,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid)) ///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.serverCertificateNotYetValid',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid',
value: -1204),
EnumMacOSPlatform(
apiName: 'URLError.serverCertificateNotYetValid', apiName: 'URLError.serverCertificateNotYetValid',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid',
@ -470,6 +615,11 @@ class WebResourceErrorType_ {
///A server certificate was rejected. ///A server certificate was rejected.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.clientCertificateRejected',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected',
value: -1205),
EnumMacOSPlatform(
apiName: 'URLError.clientCertificateRejected', apiName: 'URLError.clientCertificateRejected',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected',
@ -481,6 +631,11 @@ class WebResourceErrorType_ {
///A client certificate was required to authenticate an SSL connection during a request. ///A client certificate was required to authenticate an SSL connection during a request.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.clientCertificateRequired',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired',
value: -1206),
EnumMacOSPlatform(
apiName: 'URLError.clientCertificateRequired', apiName: 'URLError.clientCertificateRequired',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired',
@ -492,6 +647,11 @@ class WebResourceErrorType_ {
///A request to load an item only from the cache could not be satisfied. ///A request to load an item only from the cache could not be satisfied.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotLoadFromNetwork',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork',
value: -2000),
EnumMacOSPlatform(
apiName: 'URLError.cannotLoadFromNetwork', apiName: 'URLError.cannotLoadFromNetwork',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork',
@ -503,6 +663,11 @@ class WebResourceErrorType_ {
///A download task couldnt create the downloaded file on disk because of an I/O failure. ///A download task couldnt create the downloaded file on disk because of an I/O failure.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotCreateFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile',
value: -3000),
EnumMacOSPlatform(
apiName: 'URLError.cannotCreateFile', apiName: 'URLError.cannotCreateFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile',
@ -514,6 +679,11 @@ class WebResourceErrorType_ {
///A download task was unable to open the downloaded file on disk. ///A download task was unable to open the downloaded file on disk.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotOpenFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile',
value: -3001),
EnumMacOSPlatform(
apiName: 'URLError.cannotOpenFile', apiName: 'URLError.cannotOpenFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile',
@ -525,6 +695,11 @@ class WebResourceErrorType_ {
///A download task couldnt close the downloaded file on disk. ///A download task couldnt close the downloaded file on disk.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotCloseFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile',
value: -3002),
EnumMacOSPlatform(
apiName: 'URLError.cannotCloseFile', apiName: 'URLError.cannotCloseFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile',
@ -536,6 +711,11 @@ class WebResourceErrorType_ {
///A download task was unable to write to the downloaded file on disk. ///A download task was unable to write to the downloaded file on disk.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotWriteToFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile',
value: -3003),
EnumMacOSPlatform(
apiName: 'URLError.cannotWriteToFile', apiName: 'URLError.cannotWriteToFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile',
@ -547,6 +727,11 @@ class WebResourceErrorType_ {
///A download task was unable to remove a downloaded file from disk. ///A download task was unable to remove a downloaded file from disk.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotRemoveFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile',
value: -3004),
EnumMacOSPlatform(
apiName: 'URLError.cannotRemoveFile', apiName: 'URLError.cannotRemoveFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile',
@ -558,6 +743,11 @@ class WebResourceErrorType_ {
///A download task was unable to move a downloaded file on disk. ///A download task was unable to move a downloaded file on disk.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.cannotMoveFile',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile',
value: -3005),
EnumMacOSPlatform(
apiName: 'URLError.cannotMoveFile', apiName: 'URLError.cannotMoveFile',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile',
@ -572,6 +762,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream)) ///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.downloadDecodingFailedMidStream',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream',
value: -3006),
EnumMacOSPlatform(
apiName: 'URLError.downloadDecodingFailedMidStream', apiName: 'URLError.downloadDecodingFailedMidStream',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream',
@ -586,6 +781,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete)) ///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.downloadDecodingFailedToComplete',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete',
value: -3007),
EnumMacOSPlatform(
apiName: 'URLError.downloadDecodingFailedToComplete', apiName: 'URLError.downloadDecodingFailedToComplete',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete',
@ -597,6 +797,11 @@ class WebResourceErrorType_ {
///The attempted connection required activating a data context while roaming, but international roaming is disabled. ///The attempted connection required activating a data context while roaming, but international roaming is disabled.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.internationalRoamingOff',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff',
value: -1018),
EnumMacOSPlatform(
apiName: 'URLError.internationalRoamingOff', apiName: 'URLError.internationalRoamingOff',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff',
@ -608,6 +813,11 @@ class WebResourceErrorType_ {
///A connection was attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS). ///A connection was attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS).
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.callIsActive',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive',
value: -1019),
EnumMacOSPlatform(
apiName: 'URLError.callIsActive', apiName: 'URLError.callIsActive',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive',
@ -619,6 +829,11 @@ class WebResourceErrorType_ {
///The cellular network disallowed a connection. ///The cellular network disallowed a connection.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.dataNotAllowed',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed',
value: -1020),
EnumMacOSPlatform(
apiName: 'URLError.dataNotAllowed', apiName: 'URLError.dataNotAllowed',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed',
@ -630,6 +845,11 @@ class WebResourceErrorType_ {
///A body stream is needed but the client did not provide one. ///A body stream is needed but the client did not provide one.
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.requestBodyStreamExhausted',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted',
value: -1021),
EnumMacOSPlatform(
apiName: 'URLError.requestBodyStreamExhausted', apiName: 'URLError.requestBodyStreamExhausted',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted',
@ -644,6 +864,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc)) ///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.backgroundSessionRequiresSharedContainer',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc',
value: -995),
EnumMacOSPlatform(
apiName: 'URLError.backgroundSessionRequiresSharedContainer', apiName: 'URLError.backgroundSessionRequiresSharedContainer',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc',
@ -659,6 +884,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp)) ///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.backgroundSessionInUseByAnotherProcess',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp',
value: -996),
EnumMacOSPlatform(
apiName: 'URLError.backgroundSessionInUseByAnotherProcess', apiName: 'URLError.backgroundSessionInUseByAnotherProcess',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp', 'https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp',
@ -674,6 +904,11 @@ class WebResourceErrorType_ {
///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected)) ///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
@EnumSupportedPlatforms(platforms: [ @EnumSupportedPlatforms(platforms: [
EnumIOSPlatform( EnumIOSPlatform(
apiName: 'URLError.backgroundSessionWasDisconnected',
apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected',
value: -997),
EnumMacOSPlatform(
apiName: 'URLError.backgroundSessionWasDisconnected', apiName: 'URLError.backgroundSessionWasDisconnected',
apiUrl: apiUrl:
'https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected', 'https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected',

View File

@ -37,6 +37,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_BAD_URL](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_BAD_URL)) ///- Android native WebView ([Official API - WebViewClient.ERROR_BAD_URL](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_BAD_URL))
///- iOS ([Official API - URLError.badURL](https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl)) ///- iOS ([Official API - URLError.badURL](https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl))
///- MacOS ([Official API - URLError.badURL](https://developer.apple.com/documentation/foundation/urlerror/2293516-badurl))
static final BAD_URL = static final BAD_URL =
WebResourceErrorType._internalMultiPlatform('BAD_URL', () { WebResourceErrorType._internalMultiPlatform('BAD_URL', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -44,6 +45,8 @@ class WebResourceErrorType {
return -12; return -12;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1000; return -1000;
case TargetPlatform.macOS:
return -1000;
default: default:
break; break;
} }
@ -55,6 +58,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_CONNECT](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_CONNECT)) ///- Android native WebView ([Official API - WebViewClient.ERROR_CONNECT](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_CONNECT))
///- iOS ([Official API - URLError.cannotConnectToHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost)) ///- iOS ([Official API - URLError.cannotConnectToHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost))
///- MacOS ([Official API - URLError.cannotConnectToHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883001-cannotconnecttohost))
static final CANNOT_CONNECT_TO_HOST = static final CANNOT_CONNECT_TO_HOST =
WebResourceErrorType._internalMultiPlatform('CANNOT_CONNECT_TO_HOST', () { WebResourceErrorType._internalMultiPlatform('CANNOT_CONNECT_TO_HOST', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -62,6 +66,8 @@ class WebResourceErrorType {
return -6; return -6;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1004; return -1004;
case TargetPlatform.macOS:
return -1004;
default: default:
break; break;
} }
@ -103,6 +109,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_FILE_NOT_FOUND](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_FILE_NOT_FOUND)) ///- Android native WebView ([Official API - WebViewClient.ERROR_FILE_NOT_FOUND](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_FILE_NOT_FOUND))
///- iOS ([Official API - URLError.fileDoesNotExist](https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist)) ///- iOS ([Official API - URLError.fileDoesNotExist](https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist))
///- MacOS ([Official API - URLError.fileDoesNotExist](https://developer.apple.com/documentation/foundation/urlerror/code/2883074-filedoesnotexist))
static final FILE_NOT_FOUND = static final FILE_NOT_FOUND =
WebResourceErrorType._internalMultiPlatform('FILE_NOT_FOUND', () { WebResourceErrorType._internalMultiPlatform('FILE_NOT_FOUND', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -110,6 +117,8 @@ class WebResourceErrorType {
return -14; return -14;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1100; return -1100;
case TargetPlatform.macOS:
return -1100;
default: default:
break; break;
} }
@ -121,6 +130,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_HOST_LOOKUP](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_HOST_LOOKUP)) ///- Android native WebView ([Official API - WebViewClient.ERROR_HOST_LOOKUP](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_HOST_LOOKUP))
///- iOS ([Official API - URLError.cannotFindHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost)) ///- iOS ([Official API - URLError.cannotFindHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost))
///- MacOS ([Official API - URLError.cannotFindHost](https://developer.apple.com/documentation/foundation/urlerror/code/2883157-cannotfindhost))
static final HOST_LOOKUP = static final HOST_LOOKUP =
WebResourceErrorType._internalMultiPlatform('HOST_LOOKUP', () { WebResourceErrorType._internalMultiPlatform('HOST_LOOKUP', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -128,6 +138,8 @@ class WebResourceErrorType {
return -2; return -2;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1003; return -1003;
case TargetPlatform.macOS:
return -1003;
default: default:
break; break;
} }
@ -168,6 +180,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_REDIRECT_LOOP](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_REDIRECT_LOOP)) ///- Android native WebView ([Official API - WebViewClient.ERROR_REDIRECT_LOOP](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_REDIRECT_LOOP))
///- iOS ([Official API - URLError.httpTooManyRedirects](https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects)) ///- iOS ([Official API - URLError.httpTooManyRedirects](https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects))
///- MacOS ([Official API - URLError.httpTooManyRedirects](https://developer.apple.com/documentation/foundation/urlerror/code/2883099-httptoomanyredirects))
static final TOO_MANY_REDIRECTS = static final TOO_MANY_REDIRECTS =
WebResourceErrorType._internalMultiPlatform('TOO_MANY_REDIRECTS', () { WebResourceErrorType._internalMultiPlatform('TOO_MANY_REDIRECTS', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -175,6 +188,8 @@ class WebResourceErrorType {
return -9; return -9;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1007; return -1007;
case TargetPlatform.macOS:
return -1007;
default: default:
break; break;
} }
@ -186,6 +201,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_TIMEOUT](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_TIMEOUT)) ///- Android native WebView ([Official API - WebViewClient.ERROR_TIMEOUT](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_TIMEOUT))
///- iOS ([Official API - URLError.timedOut](https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout)) ///- iOS ([Official API - URLError.timedOut](https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout))
///- MacOS ([Official API - URLError.timedOut](https://developer.apple.com/documentation/foundation/urlerror/code/2883027-timedout))
static final TIMEOUT = static final TIMEOUT =
WebResourceErrorType._internalMultiPlatform('TIMEOUT', () { WebResourceErrorType._internalMultiPlatform('TIMEOUT', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -193,6 +209,8 @@ class WebResourceErrorType {
return -8; return -8;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1001; return -1001;
case TargetPlatform.macOS:
return -1001;
default: default:
break; break;
} }
@ -219,6 +237,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_UNKNOWN](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNKNOWN)) ///- Android native WebView ([Official API - WebViewClient.ERROR_UNKNOWN](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNKNOWN))
///- iOS ([Official API - URLError.unknown](https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown)) ///- iOS ([Official API - URLError.unknown](https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown))
///- MacOS ([Official API - URLError.unknown](https://developer.apple.com/documentation/foundation/urlerror/2293357-unknown))
static final UNKNOWN = static final UNKNOWN =
WebResourceErrorType._internalMultiPlatform('UNKNOWN', () { WebResourceErrorType._internalMultiPlatform('UNKNOWN', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -226,6 +245,8 @@ class WebResourceErrorType {
return -1; return -1;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1; return -1;
case TargetPlatform.macOS:
return -1;
default: default:
break; break;
} }
@ -269,6 +290,7 @@ class WebResourceErrorType {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.ERROR_UNSUPPORTED_SCHEME](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNSUPPORTED_SCHEME)) ///- Android native WebView ([Official API - WebViewClient.ERROR_UNSUPPORTED_SCHEME](https://developer.android.com/reference/android/webkit/WebViewClient#ERROR_UNSUPPORTED_SCHEME))
///- iOS ([Official API - URLError.unsupportedURL](https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl)) ///- iOS ([Official API - URLError.unsupportedURL](https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl))
///- MacOS ([Official API - URLError.unsupportedURL](https://developer.apple.com/documentation/foundation/urlerror/code/2883043-unsupportedurl))
static final UNSUPPORTED_SCHEME = static final UNSUPPORTED_SCHEME =
WebResourceErrorType._internalMultiPlatform('UNSUPPORTED_SCHEME', () { WebResourceErrorType._internalMultiPlatform('UNSUPPORTED_SCHEME', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
@ -276,6 +298,8 @@ class WebResourceErrorType {
return -10; return -10;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1002; return -1002;
case TargetPlatform.macOS:
return -1002;
default: default:
break; break;
} }
@ -286,11 +310,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cancelled](https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled)) ///- iOS ([Official API - URLError.cancelled](https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled))
///- MacOS ([Official API - URLError.cancelled](https://developer.apple.com/documentation/foundation/urlerror/code/2883178-cancelled))
static final CANCELLED = static final CANCELLED =
WebResourceErrorType._internalMultiPlatform('CANCELLED', () { WebResourceErrorType._internalMultiPlatform('CANCELLED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -999; return -999;
case TargetPlatform.macOS:
return -999;
default: default:
break; break;
} }
@ -301,12 +328,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.networkConnectionLost](https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost)) ///- iOS ([Official API - URLError.networkConnectionLost](https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost))
///- MacOS ([Official API - URLError.networkConnectionLost](https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost))
static final NETWORK_CONNECTION_LOST = static final NETWORK_CONNECTION_LOST =
WebResourceErrorType._internalMultiPlatform('NETWORK_CONNECTION_LOST', WebResourceErrorType._internalMultiPlatform('NETWORK_CONNECTION_LOST',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1005; return -1005;
case TargetPlatform.macOS:
return -1005;
default: default:
break; break;
} }
@ -318,11 +348,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.resourceUnavailable](https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable)) ///- iOS ([Official API - URLError.resourceUnavailable](https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable))
///- MacOS ([Official API - URLError.resourceUnavailable](https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable))
static final RESOURCE_UNAVAILABLE = static final RESOURCE_UNAVAILABLE =
WebResourceErrorType._internalMultiPlatform('RESOURCE_UNAVAILABLE', () { WebResourceErrorType._internalMultiPlatform('RESOURCE_UNAVAILABLE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1008; return -1008;
case TargetPlatform.macOS:
return -1008;
default: default:
break; break;
} }
@ -333,12 +366,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.notConnectedToInternet](https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet)) ///- iOS ([Official API - URLError.notConnectedToInternet](https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet))
///- MacOS ([Official API - URLError.notConnectedToInternet](https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet))
static final NOT_CONNECTED_TO_INTERNET = static final NOT_CONNECTED_TO_INTERNET =
WebResourceErrorType._internalMultiPlatform('NOT_CONNECTED_TO_INTERNET', WebResourceErrorType._internalMultiPlatform('NOT_CONNECTED_TO_INTERNET',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1009; return -1009;
case TargetPlatform.macOS:
return -1009;
default: default:
break; break;
} }
@ -349,12 +385,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.redirectToNonExistentLocation](https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation)) ///- iOS ([Official API - URLError.redirectToNonExistentLocation](https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation))
///- MacOS ([Official API - URLError.redirectToNonExistentLocation](https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation))
static final REDIRECT_TO_NON_EXISTENT_LOCATION = static final REDIRECT_TO_NON_EXISTENT_LOCATION =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'REDIRECT_TO_NON_EXISTENT_LOCATION', () { 'REDIRECT_TO_NON_EXISTENT_LOCATION', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1010; return -1010;
case TargetPlatform.macOS:
return -1010;
default: default:
break; break;
} }
@ -365,11 +404,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.badServerResponse](https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse)) ///- iOS ([Official API - URLError.badServerResponse](https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse))
///- MacOS ([Official API - URLError.badServerResponse](https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse))
static final BAD_SERVER_RESPONSE = static final BAD_SERVER_RESPONSE =
WebResourceErrorType._internalMultiPlatform('BAD_SERVER_RESPONSE', () { WebResourceErrorType._internalMultiPlatform('BAD_SERVER_RESPONSE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1011; return -1011;
case TargetPlatform.macOS:
return -1011;
default: default:
break; break;
} }
@ -381,12 +423,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.userCancelledAuthentication](https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication)) ///- iOS ([Official API - URLError.userCancelledAuthentication](https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication))
///- MacOS ([Official API - URLError.userCancelledAuthentication](https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication))
static final USER_CANCELLED_AUTHENTICATION = static final USER_CANCELLED_AUTHENTICATION =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'USER_CANCELLED_AUTHENTICATION', () { 'USER_CANCELLED_AUTHENTICATION', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1012; return -1012;
case TargetPlatform.macOS:
return -1012;
default: default:
break; break;
} }
@ -397,12 +442,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.userAuthenticationRequired](https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired)) ///- iOS ([Official API - URLError.userAuthenticationRequired](https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired))
///- MacOS ([Official API - URLError.userAuthenticationRequired](https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired))
static final USER_AUTHENTICATION_REQUIRED = static final USER_AUTHENTICATION_REQUIRED =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'USER_AUTHENTICATION_REQUIRED', () { 'USER_AUTHENTICATION_REQUIRED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1013; return -1013;
case TargetPlatform.macOS:
return -1013;
default: default:
break; break;
} }
@ -413,11 +461,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.zeroByteResource](https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource)) ///- iOS ([Official API - URLError.zeroByteResource](https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource))
///- MacOS ([Official API - URLError.zeroByteResource](https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource))
static final ZERO_BYTE_RESOURCE = static final ZERO_BYTE_RESOURCE =
WebResourceErrorType._internalMultiPlatform('ZERO_BYTE_RESOURCE', () { WebResourceErrorType._internalMultiPlatform('ZERO_BYTE_RESOURCE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1014; return -1014;
case TargetPlatform.macOS:
return -1014;
default: default:
break; break;
} }
@ -428,11 +479,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotDecodeRawData](https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata)) ///- iOS ([Official API - URLError.cannotDecodeRawData](https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata))
///- MacOS ([Official API - URLError.cannotDecodeRawData](https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata))
static final CANNOT_DECODE_RAW_DATA = static final CANNOT_DECODE_RAW_DATA =
WebResourceErrorType._internalMultiPlatform('CANNOT_DECODE_RAW_DATA', () { WebResourceErrorType._internalMultiPlatform('CANNOT_DECODE_RAW_DATA', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1015; return -1015;
case TargetPlatform.macOS:
return -1015;
default: default:
break; break;
} }
@ -443,12 +497,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotDecodeContentData](https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata)) ///- iOS ([Official API - URLError.cannotDecodeContentData](https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata))
///- MacOS ([Official API - URLError.cannotDecodeContentData](https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata))
static final CANNOT_DECODE_CONTENT_DATA = static final CANNOT_DECODE_CONTENT_DATA =
WebResourceErrorType._internalMultiPlatform('CANNOT_DECODE_CONTENT_DATA', WebResourceErrorType._internalMultiPlatform('CANNOT_DECODE_CONTENT_DATA',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1016; return -1016;
case TargetPlatform.macOS:
return -1016;
default: default:
break; break;
} }
@ -459,11 +516,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotParseResponse](https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse)) ///- iOS ([Official API - URLError.cannotParseResponse](https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse))
///- MacOS ([Official API - URLError.cannotParseResponse](https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse))
static final CANNOT_PARSE_RESPONSE = static final CANNOT_PARSE_RESPONSE =
WebResourceErrorType._internalMultiPlatform('CANNOT_PARSE_RESPONSE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_PARSE_RESPONSE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1017; return -1017;
case TargetPlatform.macOS:
return -1017;
default: default:
break; break;
} }
@ -477,12 +537,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu)) ///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
///- MacOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
static final APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION = static final APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION', () { 'APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1022; return -1022;
case TargetPlatform.macOS:
return -1022;
default: default:
break; break;
} }
@ -493,11 +556,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.fileIsDirectory](https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory)) ///- iOS ([Official API - URLError.fileIsDirectory](https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory))
///- MacOS ([Official API - URLError.fileIsDirectory](https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory))
static final FILE_IS_DIRECTORY = static final FILE_IS_DIRECTORY =
WebResourceErrorType._internalMultiPlatform('FILE_IS_DIRECTORY', () { WebResourceErrorType._internalMultiPlatform('FILE_IS_DIRECTORY', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1101; return -1101;
case TargetPlatform.macOS:
return -1101;
default: default:
break; break;
} }
@ -508,12 +574,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.noPermissionsToReadFile](https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile)) ///- iOS ([Official API - URLError.noPermissionsToReadFile](https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile))
///- MacOS ([Official API - URLError.noPermissionsToReadFile](https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile))
static final NO_PERMISSIONS_TO_READ_FILE = static final NO_PERMISSIONS_TO_READ_FILE =
WebResourceErrorType._internalMultiPlatform('NO_PERMISSIONS_TO_READ_FILE', WebResourceErrorType._internalMultiPlatform('NO_PERMISSIONS_TO_READ_FILE',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1102; return -1102;
case TargetPlatform.macOS:
return -1102;
default: default:
break; break;
} }
@ -524,12 +593,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.dataLengthExceedsMaximum](https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum)) ///- iOS ([Official API - URLError.dataLengthExceedsMaximum](https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum))
///- MacOS ([Official API - URLError.dataLengthExceedsMaximum](https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum))
static final DATA_LENGTH_EXCEEDS_MAXIMUM = static final DATA_LENGTH_EXCEEDS_MAXIMUM =
WebResourceErrorType._internalMultiPlatform('DATA_LENGTH_EXCEEDS_MAXIMUM', WebResourceErrorType._internalMultiPlatform('DATA_LENGTH_EXCEEDS_MAXIMUM',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1103; return -1103;
case TargetPlatform.macOS:
return -1103;
default: default:
break; break;
} }
@ -540,12 +612,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.secureConnectionFailed](https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed)) ///- iOS ([Official API - URLError.secureConnectionFailed](https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed))
///- MacOS ([Official API - URLError.secureConnectionFailed](https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed))
static final SECURE_CONNECTION_FAILED = static final SECURE_CONNECTION_FAILED =
WebResourceErrorType._internalMultiPlatform('SECURE_CONNECTION_FAILED', WebResourceErrorType._internalMultiPlatform('SECURE_CONNECTION_FAILED',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1200; return -1200;
case TargetPlatform.macOS:
return -1200;
default: default:
break; break;
} }
@ -556,12 +631,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasBadDate](https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate)) ///- iOS ([Official API - URLError.serverCertificateHasBadDate](https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate))
///- MacOS ([Official API - URLError.serverCertificateHasBadDate](https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate))
static final SERVER_CERTIFICATE_HAS_BAD_DATE = static final SERVER_CERTIFICATE_HAS_BAD_DATE =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'SERVER_CERTIFICATE_HAS_BAD_DATE', () { 'SERVER_CERTIFICATE_HAS_BAD_DATE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1201; return -1201;
case TargetPlatform.macOS:
return -1201;
default: default:
break; break;
} }
@ -572,12 +650,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateUntrusted](https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted)) ///- iOS ([Official API - URLError.serverCertificateUntrusted](https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted))
///- MacOS ([Official API - URLError.serverCertificateUntrusted](https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted))
static final SERVER_CERTIFICATE_UNTRUSTED = static final SERVER_CERTIFICATE_UNTRUSTED =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'SERVER_CERTIFICATE_UNTRUSTED', () { 'SERVER_CERTIFICATE_UNTRUSTED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1202; return -1202;
case TargetPlatform.macOS:
return -1202;
default: default:
break; break;
} }
@ -591,12 +672,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot)) ///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
///- MacOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
static final SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT = static final SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT', () { 'SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1203; return -1203;
case TargetPlatform.macOS:
return -1203;
default: default:
break; break;
} }
@ -610,12 +694,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid)) ///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
///- MacOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
static final SERVER_CERTIFICATE_NOT_YET_VALID = static final SERVER_CERTIFICATE_NOT_YET_VALID =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'SERVER_CERTIFICATE_NOT_YET_VALID', () { 'SERVER_CERTIFICATE_NOT_YET_VALID', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1204; return -1204;
case TargetPlatform.macOS:
return -1204;
default: default:
break; break;
} }
@ -626,12 +713,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.clientCertificateRejected](https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected)) ///- iOS ([Official API - URLError.clientCertificateRejected](https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected))
///- MacOS ([Official API - URLError.clientCertificateRejected](https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected))
static final CLIENT_CERTIFICATE_REJECTED = static final CLIENT_CERTIFICATE_REJECTED =
WebResourceErrorType._internalMultiPlatform('CLIENT_CERTIFICATE_REJECTED', WebResourceErrorType._internalMultiPlatform('CLIENT_CERTIFICATE_REJECTED',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1205; return -1205;
case TargetPlatform.macOS:
return -1205;
default: default:
break; break;
} }
@ -642,12 +732,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.clientCertificateRequired](https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired)) ///- iOS ([Official API - URLError.clientCertificateRequired](https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired))
///- MacOS ([Official API - URLError.clientCertificateRequired](https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired))
static final CLIENT_CERTIFICATE_REQUIRED = static final CLIENT_CERTIFICATE_REQUIRED =
WebResourceErrorType._internalMultiPlatform('CLIENT_CERTIFICATE_REQUIRED', WebResourceErrorType._internalMultiPlatform('CLIENT_CERTIFICATE_REQUIRED',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1206; return -1206;
case TargetPlatform.macOS:
return -1206;
default: default:
break; break;
} }
@ -658,12 +751,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotLoadFromNetwork](https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork)) ///- iOS ([Official API - URLError.cannotLoadFromNetwork](https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork))
///- MacOS ([Official API - URLError.cannotLoadFromNetwork](https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork))
static final CANNOT_LOAD_FROM_NETWORK = static final CANNOT_LOAD_FROM_NETWORK =
WebResourceErrorType._internalMultiPlatform('CANNOT_LOAD_FROM_NETWORK', WebResourceErrorType._internalMultiPlatform('CANNOT_LOAD_FROM_NETWORK',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -2000; return -2000;
case TargetPlatform.macOS:
return -2000;
default: default:
break; break;
} }
@ -674,11 +770,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotCreateFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile)) ///- iOS ([Official API - URLError.cannotCreateFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile))
///- MacOS ([Official API - URLError.cannotCreateFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile))
static final CANNOT_CREATE_FILE = static final CANNOT_CREATE_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_CREATE_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_CREATE_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3000; return -3000;
case TargetPlatform.macOS:
return -3000;
default: default:
break; break;
} }
@ -689,11 +788,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotOpenFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile)) ///- iOS ([Official API - URLError.cannotOpenFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile))
///- MacOS ([Official API - URLError.cannotOpenFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile))
static final CANNOT_OPEN_FILE = static final CANNOT_OPEN_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_OPEN_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_OPEN_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3001; return -3001;
case TargetPlatform.macOS:
return -3001;
default: default:
break; break;
} }
@ -704,11 +806,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotCloseFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile)) ///- iOS ([Official API - URLError.cannotCloseFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile))
///- MacOS ([Official API - URLError.cannotCloseFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile))
static final CANNOT_CLOSE_FILE = static final CANNOT_CLOSE_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_CLOSE_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_CLOSE_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3002; return -3002;
case TargetPlatform.macOS:
return -3002;
default: default:
break; break;
} }
@ -719,11 +824,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotWriteToFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile)) ///- iOS ([Official API - URLError.cannotWriteToFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile))
///- MacOS ([Official API - URLError.cannotWriteToFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile))
static final CANNOT_WRITE_TO_FILE = static final CANNOT_WRITE_TO_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_WRITE_TO_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_WRITE_TO_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3003; return -3003;
case TargetPlatform.macOS:
return -3003;
default: default:
break; break;
} }
@ -734,11 +842,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotRemoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile)) ///- iOS ([Official API - URLError.cannotRemoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile))
///- MacOS ([Official API - URLError.cannotRemoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile))
static final CANNOT_REMOVE_FILE = static final CANNOT_REMOVE_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_REMOVE_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_REMOVE_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3004; return -3004;
case TargetPlatform.macOS:
return -3004;
default: default:
break; break;
} }
@ -749,11 +860,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotMoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile)) ///- iOS ([Official API - URLError.cannotMoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile))
///- MacOS ([Official API - URLError.cannotMoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile))
static final CANNOT_MOVE_FILE = static final CANNOT_MOVE_FILE =
WebResourceErrorType._internalMultiPlatform('CANNOT_MOVE_FILE', () { WebResourceErrorType._internalMultiPlatform('CANNOT_MOVE_FILE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3005; return -3005;
case TargetPlatform.macOS:
return -3005;
default: default:
break; break;
} }
@ -767,12 +881,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream)) ///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
///- MacOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
static final DOWNLOAD_DECODING_FAILED_MID_STREAM = static final DOWNLOAD_DECODING_FAILED_MID_STREAM =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'DOWNLOAD_DECODING_FAILED_MID_STREAM', () { 'DOWNLOAD_DECODING_FAILED_MID_STREAM', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3006; return -3006;
case TargetPlatform.macOS:
return -3006;
default: default:
break; break;
} }
@ -786,12 +903,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete)) ///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
///- MacOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
static final DOWNLOAD_DECODING_FAILED_TO_COMPLETE = static final DOWNLOAD_DECODING_FAILED_TO_COMPLETE =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'DOWNLOAD_DECODING_FAILED_TO_COMPLETE', () { 'DOWNLOAD_DECODING_FAILED_TO_COMPLETE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -3007; return -3007;
case TargetPlatform.macOS:
return -3007;
default: default:
break; break;
} }
@ -802,12 +922,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.internationalRoamingOff](https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff)) ///- iOS ([Official API - URLError.internationalRoamingOff](https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff))
///- MacOS ([Official API - URLError.internationalRoamingOff](https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff))
static final INTERNATIONAL_ROAMING_OFF = static final INTERNATIONAL_ROAMING_OFF =
WebResourceErrorType._internalMultiPlatform('INTERNATIONAL_ROAMING_OFF', WebResourceErrorType._internalMultiPlatform('INTERNATIONAL_ROAMING_OFF',
() { () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1018; return -1018;
case TargetPlatform.macOS:
return -1018;
default: default:
break; break;
} }
@ -818,11 +941,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.callIsActive](https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive)) ///- iOS ([Official API - URLError.callIsActive](https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive))
///- MacOS ([Official API - URLError.callIsActive](https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive))
static final CALL_IS_ACTIVE = static final CALL_IS_ACTIVE =
WebResourceErrorType._internalMultiPlatform('CALL_IS_ACTIVE', () { WebResourceErrorType._internalMultiPlatform('CALL_IS_ACTIVE', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1019; return -1019;
case TargetPlatform.macOS:
return -1019;
default: default:
break; break;
} }
@ -833,11 +959,14 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.dataNotAllowed](https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed)) ///- iOS ([Official API - URLError.dataNotAllowed](https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed))
///- MacOS ([Official API - URLError.dataNotAllowed](https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed))
static final DATA_NOT_ALLOWED = static final DATA_NOT_ALLOWED =
WebResourceErrorType._internalMultiPlatform('DATA_NOT_ALLOWED', () { WebResourceErrorType._internalMultiPlatform('DATA_NOT_ALLOWED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1020; return -1020;
case TargetPlatform.macOS:
return -1020;
default: default:
break; break;
} }
@ -848,12 +977,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.requestBodyStreamExhausted](https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted)) ///- iOS ([Official API - URLError.requestBodyStreamExhausted](https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted))
///- MacOS ([Official API - URLError.requestBodyStreamExhausted](https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted))
static final REQUEST_BODY_STREAM_EXHAUSTED = static final REQUEST_BODY_STREAM_EXHAUSTED =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'REQUEST_BODY_STREAM_EXHAUSTED', () { 'REQUEST_BODY_STREAM_EXHAUSTED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -1021; return -1021;
case TargetPlatform.macOS:
return -1021;
default: default:
break; break;
} }
@ -867,12 +999,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc)) ///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
///- MacOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
static final BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER = static final BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER', () { 'BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -995; return -995;
case TargetPlatform.macOS:
return -995;
default: default:
break; break;
} }
@ -886,12 +1021,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp)) ///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
///- MacOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
static final BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS = static final BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS', () { 'BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -996; return -996;
case TargetPlatform.macOS:
return -996;
default: default:
break; break;
} }
@ -905,12 +1043,15 @@ class WebResourceErrorType {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected)) ///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
///- MacOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
static final BACKGROUND_SESSION_WAS_DISCONNECTED = static final BACKGROUND_SESSION_WAS_DISCONNECTED =
WebResourceErrorType._internalMultiPlatform( WebResourceErrorType._internalMultiPlatform(
'BACKGROUND_SESSION_WAS_DISCONNECTED', () { 'BACKGROUND_SESSION_WAS_DISCONNECTED', () {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
return -997; return -997;
case TargetPlatform.macOS:
return -997;
default: default:
break; break;
} }

View File

@ -97,7 +97,7 @@ class InAppWebViewWebElement implements Disposable {
return await getSettings(); return await getSettings();
case "setSettings": case "setSettings":
InAppWebViewSettings newSettings = InAppWebViewSettings.fromMap( InAppWebViewSettings newSettings = InAppWebViewSettings.fromMap(
call.arguments["settings"].cast<String, dynamic>()); call.arguments["settings"].cast<String, dynamic>()) ?? InAppWebViewSettings();
await setSettings(newSettings); await setSettings(newSettings);
break; break;
case "getUrl": case "getUrl":
@ -176,7 +176,7 @@ class InAppWebViewWebElement implements Disposable {
Set<Sandbox> sandbox = Set.from(Sandbox.values); Set<Sandbox> sandbox = Set.from(Sandbox.values);
if (!settings.javaScriptEnabled) { if (settings.javaScriptEnabled != null && !settings.javaScriptEnabled!) {
sandbox.remove(Sandbox.ALLOW_SCRIPTS); sandbox.remove(Sandbox.ALLOW_SCRIPTS);
} }
@ -403,8 +403,8 @@ class InAppWebViewWebElement implements Disposable {
Future<void> setSettings(InAppWebViewSettings newSettings) async { Future<void> setSettings(InAppWebViewSettings newSettings) async {
Set<Sandbox> sandbox = getSandbox(); Set<Sandbox> sandbox = getSandbox();
if (settings.javaScriptEnabled != newSettings.javaScriptEnabled) { if (newSettings.javaScriptEnabled != null && settings.javaScriptEnabled != newSettings.javaScriptEnabled) {
if (!newSettings.javaScriptEnabled) { if (!newSettings.javaScriptEnabled!) {
sandbox.remove(Sandbox.ALLOW_SCRIPTS); sandbox.remove(Sandbox.ALLOW_SCRIPTS);
} else { } else {
sandbox.add(Sandbox.ALLOW_SCRIPTS); sandbox.add(Sandbox.ALLOW_SCRIPTS);

View File

@ -16,7 +16,7 @@ typedef WebAuthenticationSessionCompletionHandler = Future<void> Function(
///A session that an app uses to authenticate a user through a web service. ///A session that an app uses to authenticate a user through a web service.
/// ///
///It is implemented using [ASWebAuthenticationSession](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession) on iOS 12.0+ ///It is implemented using [ASWebAuthenticationSession](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession) on iOS 12.0+ and MacOS 10.15+
///and [SFAuthenticationSession](https://developer.apple.com/documentation/safariservices/sfauthenticationsession) on iOS 11.0. ///and [SFAuthenticationSession](https://developer.apple.com/documentation/safariservices/sfauthenticationsession) on iOS 11.0.
/// ///
///Use an [WebAuthenticationSession] instance to authenticate a user through a web service, including one run by a third party. ///Use an [WebAuthenticationSession] instance to authenticate a user through a web service, including one run by a third party.
@ -32,8 +32,11 @@ typedef WebAuthenticationSessionCompletionHandler = Future<void> Function(
/// ///
///**NOTE for iOS**: Available only on iOS 11.0+. ///**NOTE for iOS**: Available only on iOS 11.0+.
/// ///
///**NOTE for MacOS**: Available only on MacOS 10.15+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
class WebAuthenticationSession implements Disposable { class WebAuthenticationSession implements Disposable {
///Debug settings. ///Debug settings.
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(); static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();

View File

@ -16,8 +16,11 @@ class WebAuthenticationSessionSettings {
/// ///
///**NOTE for iOS**: Available only on iOS 13.0+. ///**NOTE for iOS**: Available only on iOS 13.0+.
/// ///
///**NOTE for MacOS**: Available only on iOS 10.15+.
///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///- MacOS
bool prefersEphemeralWebBrowserSession; bool prefersEphemeralWebBrowserSession;
WebAuthenticationSessionSettings( WebAuthenticationSessionSettings(

View File

@ -3,6 +3,11 @@ import '../types/main.dart';
import '../in_app_webview/in_app_webview_controller.dart'; import '../in_app_webview/in_app_webview_controller.dart';
///The representation of the [HTML5 message channels](https://html.spec.whatwg.org/multipage/web-messaging.html#message-channels). ///The representation of the [HTML5 message channels](https://html.spec.whatwg.org/multipage/web-messaging.html#message-channels).
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
class WebMessageChannel { class WebMessageChannel {
///Message Channel ID used internally. ///Message Channel ID used internally.
final String id; final String id;

View File

@ -3,6 +3,11 @@ import '../in_app_webview/in_app_webview_controller.dart';
import '../types/main.dart'; import '../types/main.dart';
///This listener receives messages sent on the JavaScript object which was injected by [InAppWebViewController.addWebMessageListener]. ///This listener receives messages sent on the JavaScript object which was injected by [InAppWebViewController.addWebMessageListener].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
class WebMessageListener { class WebMessageListener {
///The name for the injected JavaScript object. ///The name for the injected JavaScript object.
final String jsObjectName; final String jsObjectName;

View File

@ -9,6 +9,7 @@ import '../types/main.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
///- Web ///- Web
class WebStorage { class WebStorage {
///Represents `window.localStorage`. ///Represents `window.localStorage`.

View File

@ -17,6 +17,7 @@ import '../types/main.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS
class WebStorageManager { class WebStorageManager {
static WebStorageManager? _instance; static WebStorageManager? _instance;
static const MethodChannel _staticChannel = WEB_STORAGE_STATIC_CHANNEL; static const MethodChannel _staticChannel = WEB_STORAGE_STATIC_CHANNEL;
@ -121,6 +122,7 @@ class WebStorageManager {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebsiteDataStore.fetchDataRecords](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532932-fetchdatarecords)) ///- iOS ([Official API - WKWebsiteDataStore.fetchDataRecords](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532932-fetchdatarecords))
///- MacOS ([Official API - WKWebsiteDataStore.fetchDataRecords](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532932-fetchdatarecords))
Future<List<WebsiteDataRecord>> fetchDataRecords( Future<List<WebsiteDataRecord>> fetchDataRecords(
{required Set<WebsiteDataType> dataTypes}) async { {required Set<WebsiteDataType> dataTypes}) async {
List<WebsiteDataRecord> recordList = []; List<WebsiteDataRecord> recordList = [];
@ -156,6 +158,7 @@ class WebStorageManager {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata)) ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata))
///- MacOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata))
Future<void> removeDataFor( Future<void> removeDataFor(
{required Set<WebsiteDataType> dataTypes, {required Set<WebsiteDataType> dataTypes,
required List<WebsiteDataRecord> dataRecords}) async { required List<WebsiteDataRecord> dataRecords}) async {
@ -183,6 +186,7 @@ class WebStorageManager {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata)) ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata))
///- MacOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata))
Future<void> removeDataModifiedSince( Future<void> removeDataModifiedSince(
{required Set<WebsiteDataType> dataTypes, required DateTime date}) async { {required Set<WebsiteDataType> dataTypes, required DateTime date}) async {
List<String> dataTypesList = []; List<String> dataTypesList = [];

View File

@ -71,9 +71,9 @@ public class InAppBrowserManager: ChannelDelegate {
webViewController.initialMimeType = mimeType webViewController.initialMimeType = mimeType
webViewController.initialEncoding = encoding webViewController.initialEncoding = encoding
webViewController.initialBaseUrl = baseUrl webViewController.initialBaseUrl = baseUrl
webViewController.contextMenu = contextMenu
webViewController.windowId = windowId webViewController.windowId = windowId
webViewController.initialUserScripts = initialUserScripts ?? [] webViewController.initialUserScripts = initialUserScripts ?? []
webViewController.isHidden = browserSettings.hidden
let window = InAppBrowserWindow(contentViewController: webViewController) let window = InAppBrowserWindow(contentViewController: webViewController)
window.browserSettings = browserSettings window.browserSettings = browserSettings

View File

@ -15,18 +15,7 @@ public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
var toolbarTopBackgroundColor: String? var toolbarTopBackgroundColor: String?
var hideUrlBar = false var hideUrlBar = false
var hideProgressBar = false var hideProgressBar = false
var toolbarTopFixedTitle: String?
var toolbarTopTranslucent = true
var toolbarTopBarTintColor: String?
var toolbarTopTintColor: String?
var hideToolbarBottom = true
var toolbarBottomBackgroundColor: String?
var toolbarBottomTintColor: String?
var toolbarBottomTranslucent = true
var closeButtonCaption: String?
var closeButtonColor: String?
var presentationStyle = 0 //fullscreen
var transitionStyle = 0 //crossDissolve
override init(){ override init(){
super.init() super.init()
@ -35,10 +24,11 @@ public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
override func getRealSettings(obj: InAppBrowserWebViewController?) -> [String: Any?] { override func getRealSettings(obj: InAppBrowserWebViewController?) -> [String: Any?] {
var realOptions: [String: Any?] = toMap() var realOptions: [String: Any?] = toMap()
if let inAppBrowserWebViewController = obj { if let inAppBrowserWebViewController = obj {
realOptions["hidden"] = inAppBrowserWebViewController.isHidden
realOptions["hideUrlBar"] = inAppBrowserWebViewController.window?.searchBar?.isHidden realOptions["hideUrlBar"] = inAppBrowserWebViewController.window?.searchBar?.isHidden
realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["hideToolbarTop"] = !(inAppBrowserWebViewController.window?.toolbar?.isVisible ?? true) realOptions["hideToolbarTop"] = !(inAppBrowserWebViewController.window?.toolbar?.isVisible ?? true)
realOptions["toolbarTopBackgroundColor"] = inAppBrowserWebViewController.window?.backgroundColor realOptions["toolbarTopBackgroundColor"] = inAppBrowserWebViewController.window?.backgroundColor.hexString
} }
return realOptions return realOptions
} }

View File

@ -22,7 +22,6 @@ public class InAppBrowserWebViewController: NSViewController, InAppBrowserDelega
var channelDelegate: InAppBrowserChannelDelegate? var channelDelegate: InAppBrowserChannelDelegate?
var initialUrlRequest: URLRequest? var initialUrlRequest: URLRequest?
var initialFile: String? var initialFile: String?
var contextMenu: [String: Any]?
var browserSettings: InAppBrowserSettings? var browserSettings: InAppBrowserSettings?
var webViewSettings: InAppWebViewSettings? var webViewSettings: InAppWebViewSettings?
var initialData: String? var initialData: String?
@ -30,6 +29,7 @@ public class InAppBrowserWebViewController: NSViewController, InAppBrowserDelega
var initialEncoding: String? var initialEncoding: String?
var initialBaseUrl: String? var initialBaseUrl: String?
var initialUserScripts: [[String: Any]] = [] var initialUserScripts: [[String: Any]] = []
var isHidden = false
public override func loadView() { public override func loadView() {
let channel = FlutterMethodChannel(name: InAppBrowserWebViewController.METHOD_CHANNEL_NAME_PREFIX + id, binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger) let channel = FlutterMethodChannel(name: InAppBrowserWebViewController.METHOD_CHANNEL_NAME_PREFIX + id, binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger)
@ -43,14 +43,12 @@ public class InAppBrowserWebViewController: NSViewController, InAppBrowserDelega
let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(settings: webViewSettings) let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(settings: webViewSettings)
if let wId = windowId, let webViewTransport = InAppWebView.windowWebViews[wId] { if let wId = windowId, let webViewTransport = InAppWebView.windowWebViews[wId] {
webView = webViewTransport.webView webView = webViewTransport.webView
webView!.contextMenu = contextMenu
webView!.initialUserScripts = userScripts webView!.initialUserScripts = userScripts
} else { } else {
webView = InAppWebView(id: nil, webView = InAppWebView(id: nil,
registrar: nil, registrar: nil,
frame: .zero, frame: .zero,
configuration: preWebviewConfiguration, configuration: preWebviewConfiguration,
contextMenu: contextMenu,
userScripts: userScripts) userScripts: userScripts)
} }
@ -184,7 +182,12 @@ public class InAppBrowserWebViewController: NSViewController, InAppBrowserDelega
guard let title = title else { guard let title = title else {
return return
} }
if let browserSettings = browserSettings,
let toolbarTopFixedTitle = browserSettings.toolbarTopFixedTitle {
window?.title = toolbarTopFixedTitle
} else {
window?.title = title window?.title = title
}
window?.update() window?.update()
} }
@ -281,10 +284,12 @@ public class InAppBrowserWebViewController: NSViewController, InAppBrowserDelega
} }
public func hide() { public func hide() {
isHidden = true
window?.hide() window?.hide()
} }
public func show() { public func show() {
isHidden = false
window?.show() window?.show()
} }

View File

@ -123,6 +123,9 @@ public class InAppBrowserWindow : NSWindow, NSWindowDelegate, NSToolbarDelegate,
backButton?.isEnabled = false backButton?.isEnabled = false
if let browserSettings = browserSettings { if let browserSettings = browserSettings {
if let toolbarTopFixedTitle = browserSettings.toolbarTopFixedTitle {
title = toolbarTopFixedTitle
}
if !browserSettings.hideToolbarTop { if !browserSettings.hideToolbarTop {
toolbar?.isVisible = true toolbar?.isVisible = true
if browserSettings.hideUrlBar { if browserSettings.hideUrlBar {

View File

@ -19,7 +19,6 @@ public class FlutterWebViewController: NSObject, /*FlutterPlatformView,*/ Dispos
myView = NSView(frame: frame) myView = NSView(frame: frame)
let initialSettings = params["initialSettings"] as! [String: Any?] let initialSettings = params["initialSettings"] as! [String: Any?]
let contextMenu = params["contextMenu"] as? [String: Any]
let windowId = params["windowId"] as? Int64 let windowId = params["windowId"] as? Int64
let initialUserScripts = params["initialUserScripts"] as? [[String: Any]] let initialUserScripts = params["initialUserScripts"] as? [[String: Any]]
@ -43,14 +42,12 @@ public class FlutterWebViewController: NSObject, /*FlutterPlatformView,*/ Dispos
binaryMessenger: registrar.messenger) binaryMessenger: registrar.messenger)
webView!.channelDelegate = WebViewChannelDelegate(webView: webView!, channel: channel) webView!.channelDelegate = WebViewChannelDelegate(webView: webView!, channel: channel)
webView!.frame = myView!.bounds webView!.frame = myView!.bounds
webView!.contextMenu = contextMenu
webView!.initialUserScripts = userScripts webView!.initialUserScripts = userScripts
} else { } else {
webView = InAppWebView(id: viewId, webView = InAppWebView(id: viewId,
registrar: registrar, registrar: registrar,
frame: myView!.bounds, frame: myView!.bounds,
configuration: preWebviewConfiguration, configuration: preWebviewConfiguration,
contextMenu: contextMenu,
userScripts: userScripts) userScripts: userScripts)
} }

View File

@ -38,18 +38,8 @@ public class InAppWebView: WKWebView, WKUIDelegate,
var isPausedTimers = false var isPausedTimers = false
var isPausedTimersCompletionHandler: (() -> Void)? var isPausedTimersCompletionHandler: (() -> Void)?
var contextMenu: [String: Any]?
var initialUserScripts: [UserScript] = [] var initialUserScripts: [UserScript] = []
var lastLongPressTouchPoint: CGPoint?
var lastTouchPoint: CGPoint?
var lastTouchPointTimestamp = Int64(Date().timeIntervalSince1970 * 1000)
var contextMenuIsShowing = false
// flag used for the workaround to trigger onCreateContextMenu event as the same on Android
var onCreateContextMenuEventTriggeredWhenMenuDisabled = false
var customIMPs: [IMP] = [] var customIMPs: [IMP] = []
static var windowWebViews: [Int64:WebViewTransport] = [:] static var windowWebViews: [Int64:WebViewTransport] = [:]
@ -57,10 +47,8 @@ public class InAppWebView: WKWebView, WKUIDelegate,
var callAsyncJavaScriptBelowIOS14Results: [String:((Any?) -> Void)] = [:] var callAsyncJavaScriptBelowIOS14Results: [String:((Any?) -> Void)] = [:]
var oldZoomScale = Float(1.0)
init(id: Any?, registrar: FlutterPluginRegistrar?, frame: CGRect, configuration: WKWebViewConfiguration, init(id: Any?, registrar: FlutterPluginRegistrar?, frame: CGRect, configuration: WKWebViewConfiguration,
contextMenu: [String: Any]?, userScripts: [UserScript] = []) { userScripts: [UserScript] = []) {
super.init(frame: frame, configuration: configuration) super.init(frame: frame, configuration: configuration)
self.id = id self.id = id
if let id = id, let registrar = registrar { if let id = id, let registrar = registrar {
@ -68,7 +56,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
binaryMessenger: registrar.messenger) binaryMessenger: registrar.messenger)
self.channelDelegate = WebViewChannelDelegate(webView: self, channel: channel) self.channelDelegate = WebViewChannelDelegate(webView: self, channel: channel)
} }
self.contextMenu = contextMenu
self.initialUserScripts = userScripts self.initialUserScripts = userScripts
uiDelegate = self uiDelegate = self
navigationDelegate = self navigationDelegate = self
@ -133,12 +120,10 @@ public class InAppWebView: WKWebView, WKUIDelegate,
} }
allowsBackForwardNavigationGestures = settings.allowsBackForwardNavigationGestures allowsBackForwardNavigationGestures = settings.allowsBackForwardNavigationGestures
if #available(iOS 9.0, *) {
allowsLinkPreview = settings.allowsLinkPreview allowsLinkPreview = settings.allowsLinkPreview
if !settings.userAgent.isEmpty { if !settings.userAgent.isEmpty {
customUserAgent = settings.userAgent customUserAgent = settings.userAgent
} }
}
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
mediaType = settings.mediaType mediaType = settings.mediaType
@ -216,7 +201,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
configuration.userContentController.addPluginScript(ON_WINDOW_BLUR_EVENT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(ON_WINDOW_BLUR_EVENT_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(ON_WINDOW_FOCUS_EVENT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(ON_WINDOW_FOCUS_EVENT_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(FIND_ELEMENTS_AT_POINT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(FIND_ELEMENTS_AT_POINT_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(FIND_TEXT_HIGHLIGHT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(FIND_TEXT_HIGHLIGHT_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(ORIGINAL_VIEWPORT_METATAG_CONTENT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(ORIGINAL_VIEWPORT_METATAG_CONTENT_JS_PLUGIN_SCRIPT)
configuration.userContentController.addPluginScript(ON_SCROLL_CHANGED_EVENT_JS_PLUGIN_SCRIPT) configuration.userContentController.addPluginScript(ON_SCROLL_CHANGED_EVENT_JS_PLUGIN_SCRIPT)
@ -308,43 +292,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
return configuration return configuration
} }
@objc func onCreateContextMenu() {
let mapSorted = SharedLastTouchPointTimestamp.sorted { $0.value > $1.value }
if (mapSorted.first?.key != self) {
return
}
contextMenuIsShowing = true
let hitTestResult = HitTestResult(type: .unknownType, extra: nil)
if let lastLongPressTouhLocation = lastLongPressTouchPoint {
if configuration.preferences.javaScriptEnabled {
self.evaluateJavaScript("window.\(JAVASCRIPT_BRIDGE_NAME)._findElementsAtPoint(\(lastLongPressTouhLocation.x),\(lastLongPressTouhLocation.y))", completionHandler: {(value, error) in
if error != nil {
print("Long press gesture recognizer error: \(error?.localizedDescription ?? "")")
} else if let value = value as? [String: Any?] {
self.channelDelegate?.onCreateContextMenu(hitTestResult: HitTestResult.fromMap(map: value) ?? hitTestResult)
} else {
self.channelDelegate?.onCreateContextMenu(hitTestResult: hitTestResult)
}
})
} else {
channelDelegate?.onCreateContextMenu(hitTestResult: hitTestResult)
}
} else {
channelDelegate?.onCreateContextMenu(hitTestResult: hitTestResult)
}
}
@objc func onHideContextMenu() {
if contextMenuIsShowing == false {
return
}
contextMenuIsShowing = false
channelDelegate?.onHideContextMenu()
}
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, override public func observeValue(forKeyPath keyPath: String?, of object: Any?,
change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == #keyPath(WKWebView.estimatedProgress) { if keyPath == #keyPath(WKWebView.estimatedProgress) {
@ -546,7 +493,7 @@ public class InAppWebView: WKWebView, WKUIDelegate,
public func loadUrl(urlRequest: URLRequest, allowingReadAccessTo: URL?) { public func loadUrl(urlRequest: URLRequest, allowingReadAccessTo: URL?) {
let url = urlRequest.url! let url = urlRequest.url!
if #available(iOS 9.0, *), let allowingReadAccessTo = allowingReadAccessTo, url.scheme == "file", allowingReadAccessTo.scheme == "file" { if let allowingReadAccessTo = allowingReadAccessTo, url.scheme == "file", allowingReadAccessTo.scheme == "file" {
loadFileURL(url, allowingReadAccessTo: allowingReadAccessTo) loadFileURL(url, allowingReadAccessTo: allowingReadAccessTo)
} else { } else {
load(urlRequest) load(urlRequest)
@ -563,15 +510,10 @@ public class InAppWebView: WKWebView, WKUIDelegate,
} }
public func loadData(data: String, mimeType: String, encoding: String, baseUrl: URL, allowingReadAccessTo: URL?) { public func loadData(data: String, mimeType: String, encoding: String, baseUrl: URL, allowingReadAccessTo: URL?) {
if #available(iOS 9.0, *), let allowingReadAccessTo = allowingReadAccessTo, baseUrl.scheme == "file", allowingReadAccessTo.scheme == "file" { if let allowingReadAccessTo = allowingReadAccessTo, baseUrl.scheme == "file", allowingReadAccessTo.scheme == "file" {
loadFileURL(baseUrl, allowingReadAccessTo: allowingReadAccessTo) loadFileURL(baseUrl, allowingReadAccessTo: allowingReadAccessTo)
} }
if #available(iOS 9.0, *) {
load(data.data(using: .utf8)!, mimeType: mimeType, characterEncodingName: encoding, baseURL: baseUrl) load(data.data(using: .utf8)!, mimeType: mimeType, characterEncodingName: encoding, baseURL: baseUrl)
} else {
loadHTMLString(data, baseURL: baseUrl)
}
} }
public func loadFile(assetFilePath: String) throws { public func loadFile(assetFilePath: String) throws {
@ -583,7 +525,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
func setSettings(newSettings: InAppWebViewSettings, newSettingsMap: [String: Any]) { func setSettings(newSettings: InAppWebViewSettings, newSettingsMap: [String: Any]) {
// MUST be the first! In this way, all the settings that uses evaluateJavaScript can be applied/blocked! // MUST be the first! In this way, all the settings that uses evaluateJavaScript can be applied/blocked!
if #available(iOS 13.0, *) {
if newSettingsMap["applePayAPIEnabled"] != nil && settings?.applePayAPIEnabled != newSettings.applePayAPIEnabled { if newSettingsMap["applePayAPIEnabled"] != nil && settings?.applePayAPIEnabled != newSettings.applePayAPIEnabled {
if let settings = settings { if let settings = settings {
settings.applePayAPIEnabled = newSettings.applePayAPIEnabled settings.applePayAPIEnabled = newSettings.applePayAPIEnabled
@ -595,7 +536,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
configuration.userContentController.removeAllUserScripts() configuration.userContentController.removeAllUserScripts()
} }
} }
}
if (newSettingsMap["incognito"] != nil && settings?.incognito != newSettings.incognito && newSettings.incognito) { if (newSettingsMap["incognito"] != nil && settings?.incognito != newSettings.incognito && newSettings.incognito) {
configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent() configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
@ -1122,9 +1062,7 @@ public class InAppWebView: WKWebView, WKUIDelegate,
return result; return result;
} }
@available(iOS 15.0, *)
@available(macOS 12.0, *) @available(macOS 12.0, *)
@available(macCatalyst 15.0, *)
public func webView(_ webView: WKWebView, public func webView(_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin, requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo, initiatedByFrame frame: WKFrameInfo,
@ -1301,7 +1239,6 @@ public class InAppWebView: WKWebView, WKUIDelegate,
public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
currentOriginalUrl = url currentOriginalUrl = url
lastTouchPoint = nil
disposeWebMessageChannels() disposeWebMessageChannels()
initializeWindowIdJS() initializeWindowIdJS()
@ -1585,10 +1522,8 @@ public class InAppWebView: WKWebView, WKUIDelegate,
} }
} else { } else {
print("Security Error: " + securityError.description) print("Security Error: " + securityError.description)
if #available(iOS 11.3, *) {
print(SecCopyErrorMessageString(securityError,nil) ?? "") print(SecCopyErrorMessageString(securityError,nil) ?? "")
} }
}
return identityAndTrust; return identityAndTrust;
} }
@ -1762,7 +1697,7 @@ public class InAppWebView: WKWebView, WKUIDelegate,
InAppWebView.windowAutoincrementId += 1 InAppWebView.windowAutoincrementId += 1
let windowId = InAppWebView.windowAutoincrementId let windowId = InAppWebView.windowAutoincrementId
let windowWebView = InAppWebView(id: nil, registrar: nil, frame: CGRect.zero, configuration: configuration, contextMenu: nil) let windowWebView = InAppWebView(id: nil, registrar: nil, frame: CGRect.zero, configuration: configuration)
windowWebView.windowId = windowId windowWebView.windowId = windowId
let webViewTransport = WebViewTransport( let webViewTransport = WebViewTransport(
@ -1950,20 +1885,10 @@ public class InAppWebView: WKWebView, WKUIDelegate,
// https://stackoverflow.com/a/42840541/4637638 // https://stackoverflow.com/a/42840541/4637638
public func isVideoPlayerWindow(_ notificationObject: AnyObject?) -> Bool { public func isVideoPlayerWindow(_ notificationObject: AnyObject?) -> Bool {
let nonVideoClasses = ["_UIAlertControllerShimPresenterWindow", if let obj = notificationObject, let clazz = NSClassFromString("WebCoreFullScreenWindow") {
"UITextEffectsWindow", return obj.isKind(of: clazz)
"UIRemoteKeyboardWindow",
"PGHostedWindow"]
var isVideo = true
if let obj = notificationObject {
for nonVideoClass in nonVideoClasses {
if let clazz = NSClassFromString(nonVideoClass) {
isVideo = isVideo && !(obj.isKind(of: clazz))
} }
} return false
}
return isVideo
} }
@objc func onEnterFullscreen(_ notification: Notification) { @objc func onEnterFullscreen(_ notification: Notification) {
@ -2152,27 +2077,18 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
if let webMessageListener = webMessageListeners.first(where: ({($0.jsObjectName == jsObjectName)})) { if let webMessageListener = webMessageListeners.first(where: ({($0.jsObjectName == jsObjectName)})) {
let isMainFrame = message.frameInfo.isMainFrame let isMainFrame = message.frameInfo.isMainFrame
var scheme: String? = nil let securityOrigin = message.frameInfo.securityOrigin
var host: String? = nil let scheme = securityOrigin.protocol
var port: Int? = nil let host = securityOrigin.host
if #available(iOS 9.0, *) { let port = securityOrigin.port
let sourceOrigin = message.frameInfo.securityOrigin
scheme = sourceOrigin.protocol
host = sourceOrigin.host
port = sourceOrigin.port
} else if let url = message.frameInfo.request.url {
scheme = url.scheme
host = url.host
port = url.port
}
if !webMessageListener.isOriginAllowed(scheme: scheme, host: host, port: port) { if !webMessageListener.isOriginAllowed(scheme: scheme, host: host, port: port) {
return return
} }
var sourceOrigin: URL? = nil var sourceOrigin: URL? = nil
if let scheme = scheme, !scheme.isEmpty, let host = host, !host.isEmpty { if !scheme.isEmpty, !host.isEmpty {
sourceOrigin = URL(string: "\(scheme)://\(host)\(port != nil && port != 0 ? ":" + String(port!) : "")") sourceOrigin = URL(string: "\(scheme)://\(host)\(port != 0 ? ":" + String(port) : "")")
} }
webMessageListener.channelDelegate?.onPostMessage(message: messageData, sourceOrigin: sourceOrigin, isMainFrame: isMainFrame) webMessageListener.channelDelegate?.onPostMessage(message: messageData, sourceOrigin: sourceOrigin, isMainFrame: isMainFrame)
} }
@ -2372,6 +2288,16 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
} }
} }
public func getContentWidth(completionHandler: @escaping ((Int64?, Error?) -> Void)) {
evaluateJavaScript("document.body.scrollWidth") { scrollWidth, error in
if let error = error {
completionHandler(nil, error)
} else {
completionHandler(Int64(scrollWidth as? Double ?? 0.0), nil)
}
}
}
public func getOriginalUrl() -> URL? { public func getOriginalUrl() -> URL? {
return currentOriginalUrl return currentOriginalUrl
} }
@ -2384,56 +2310,6 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
} }
} }
public func getHitTestResult(completionHandler: @escaping (HitTestResult) -> Void) {
if configuration.preferences.javaScriptEnabled, let lastTouchLocation = lastTouchPoint {
self.evaluateJavaScript("window.\(JAVASCRIPT_BRIDGE_NAME)._findElementsAtPoint(\(lastTouchLocation.x),\(lastTouchLocation.y))", completionHandler: {(value, error) in
if error != nil {
print("getHitTestResult error: \(error?.localizedDescription ?? "")")
completionHandler(HitTestResult(type: .unknownType, extra: nil))
} else if let value = value as? [String: Any?] {
let hitTestResult = HitTestResult.fromMap(map: value)!
completionHandler(hitTestResult)
} else {
completionHandler(HitTestResult(type: .unknownType, extra: nil))
}
})
} else {
completionHandler(HitTestResult(type: .unknownType, extra: nil))
}
}
public func requestFocusNodeHref(completionHandler: @escaping ([String: Any?]?, Error?) -> Void) {
if configuration.preferences.javaScriptEnabled {
// add some delay to make it sure _lastAnchorOrImageTouched is updated
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
self.evaluateJavaScript("window.\(JAVASCRIPT_BRIDGE_NAME)._lastAnchorOrImageTouched", completionHandler: {(value, error) in
let lastAnchorOrImageTouched = value as? [String: Any?]
completionHandler(lastAnchorOrImageTouched, error)
})
}
} else {
completionHandler(nil, nil)
}
}
public func requestImageRef(completionHandler: @escaping ([String: Any?]?, Error?) -> Void) {
if configuration.preferences.javaScriptEnabled {
// add some delay to make it sure _lastImageTouched is updated
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
self.evaluateJavaScript("window.\(JAVASCRIPT_BRIDGE_NAME)._lastImageTouched", completionHandler: {(value, error) in
let lastImageTouched = value as? [String: Any?]
completionHandler(lastImageTouched, error)
})
}
} else {
completionHandler(nil, nil)
}
}
public func clearFocus() {
self.enclosingScrollView?.subviews.first?.resignFirstResponder()
}
public func getCertificate() -> SslCertificate? { public func getCertificate() -> SslCertificate? {
guard let scheme = url?.scheme, guard let scheme = url?.scheme,
scheme == "https", scheme == "https",
@ -2454,12 +2330,24 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
} }
} }
public func canScrollVertically() -> Bool { public func canScrollVertically(completionHandler: @escaping ((Bool, Error?) -> Void)) {
return enclosingScrollView?.contentSize.height ?? 0 > self.frame.height getContentHeight { contentHeight, error in
if let error = error {
completionHandler(false, error)
} else {
completionHandler(CGFloat(contentHeight ?? 0) > self.frame.height, nil)
}
}
} }
public func canScrollHorizontally() -> Bool { public func canScrollHorizontally(completionHandler: @escaping ((Bool, Error?) -> Void)) {
return enclosingScrollView?.contentSize.width ?? 0 > self.frame.width getContentWidth { contentWidth, error in
if let error = error {
completionHandler(false, error)
} else {
completionHandler(CGFloat(contentWidth ?? 0) > self.frame.width, nil)
}
}
} }
public func createWebMessageChannel(completionHandler: ((WebMessageChannel) -> Void)? = nil) -> WebMessageChannel { public func createWebMessageChannel(completionHandler: ((WebMessageChannel) -> Void)? = nil) -> WebMessageChannel {
@ -2578,7 +2466,6 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
uiDelegate = nil uiDelegate = nil
navigationDelegate = nil navigationDelegate = nil
isPausedTimersCompletionHandler = nil isPausedTimersCompletionHandler = nil
SharedLastTouchPointTimestamp.removeValue(forKey: self)
callAsyncJavaScriptBelowIOS14Results.removeAll() callAsyncJavaScriptBelowIOS14Results.removeAll()
super.removeFromSuperview() super.removeFromSuperview()
} }

View File

@ -20,8 +20,6 @@ public class InAppWebViewSettings: ISettings<InAppWebView> {
var javaScriptEnabled = true var javaScriptEnabled = true
var javaScriptCanOpenWindowsAutomatically = false var javaScriptCanOpenWindowsAutomatically = false
var mediaPlaybackRequiresUserGesture = true var mediaPlaybackRequiresUserGesture = true
var verticalScrollBarEnabled = true
var horizontalScrollBarEnabled = true
var resourceCustomSchemes: [String] = [] var resourceCustomSchemes: [String] = []
var contentBlockers: [[String: [String : Any]]] = [] var contentBlockers: [[String: [String : Any]]] = []
var minimumFontSize = 0 var minimumFontSize = 0
@ -30,54 +28,29 @@ public class InAppWebViewSettings: ISettings<InAppWebView> {
var incognito = false var incognito = false
var cacheEnabled = true var cacheEnabled = true
var transparentBackground = false var transparentBackground = false
var disableVerticalScroll = false
var disableHorizontalScroll = false
var disableContextMenu = false
var supportZoom = true var supportZoom = true
var allowUniversalAccessFromFileURLs = false var allowUniversalAccessFromFileURLs = false
var allowFileAccessFromFileURLs = false var allowFileAccessFromFileURLs = false
var disallowOverScroll = false
var enableViewportScale = false var enableViewportScale = false
var suppressesIncrementalRendering = false var suppressesIncrementalRendering = false
var allowsAirPlayForMediaPlayback = true var allowsAirPlayForMediaPlayback = true
var allowsBackForwardNavigationGestures = true var allowsBackForwardNavigationGestures = true
var allowsLinkPreview = true var allowsLinkPreview = true
var ignoresViewportScaleLimits = false
var allowsInlineMediaPlayback = false
var allowsPictureInPictureMediaPlayback = true
var isFraudulentWebsiteWarningEnabled = true var isFraudulentWebsiteWarningEnabled = true
var selectionGranularity = 0
var dataDetectorTypes: [String] = ["NONE"] // WKDataDetectorTypeNone
var preferredContentMode = 0 var preferredContentMode = 0
var sharedCookiesEnabled = false var sharedCookiesEnabled = false
var automaticallyAdjustsScrollIndicatorInsets = false
var accessibilityIgnoresInvertColors = false
var decelerationRate = "NORMAL" // UIScrollView.DecelerationRate.normal
var alwaysBounceVertical = false
var alwaysBounceHorizontal = false
var scrollsToTop = true
var isPagingEnabled = false
var maximumZoomScale = 1.0
var minimumZoomScale = 1.0
var contentInsetAdjustmentBehavior = 2 // UIScrollView.ContentInsetAdjustmentBehavior.never
var isDirectionalLockEnabled = false
var mediaType: String? = nil var mediaType: String? = nil
var pageZoom = 1.0 var pageZoom = 1.0
var limitsNavigationsToAppBoundDomains = false var limitsNavigationsToAppBoundDomains = false
var useOnNavigationResponse = false var useOnNavigationResponse = false
var applePayAPIEnabled = false var applePayAPIEnabled = false
var allowingReadAccessTo: String? = nil var allowingReadAccessTo: String? = nil
var disableLongPressContextMenuOnLinks = false
var disableInputAccessoryView = false
var underPageBackgroundColor: String? var underPageBackgroundColor: String?
var isTextInteractionEnabled = true var isTextInteractionEnabled = true
var isSiteSpecificQuirksModeEnabled = true var isSiteSpecificQuirksModeEnabled = true
var upgradeKnownHostsToHTTPS = true var upgradeKnownHostsToHTTPS = true
var isElementFullscreenEnabled = true var isElementFullscreenEnabled = true
var isFindInteractionEnabled = false
var minimumViewportInset: NSEdgeInsets? = nil
var maximumViewportInset: NSEdgeInsets? = nil
override init(){ override init(){
super.init() super.init()
@ -105,7 +78,7 @@ public class InAppWebViewSettings: ISettings<InAppWebView> {
if #available(macOS 10.12, *) { if #available(macOS 10.12, *) {
realSettings["mediaPlaybackRequiresUserGesture"] = configuration.mediaTypesRequiringUserActionForPlayback == .all realSettings["mediaPlaybackRequiresUserGesture"] = configuration.mediaTypesRequiringUserActionForPlayback == .all
} }
realSettings["minimumFontSize"] = configuration.preferences.minimumFontSize realSettings["minimumFontSize"] = Int(configuration.preferences.minimumFontSize)
realSettings["suppressesIncrementalRendering"] = configuration.suppressesIncrementalRendering realSettings["suppressesIncrementalRendering"] = configuration.suppressesIncrementalRendering
realSettings["allowsBackForwardNavigationGestures"] = webView.allowsBackForwardNavigationGestures realSettings["allowsBackForwardNavigationGestures"] = webView.allowsBackForwardNavigationGestures
if #available(macOS 10.15, *) { if #available(macOS 10.15, *) {

View File

@ -204,6 +204,13 @@ public class WebViewChannelDelegate : ChannelDelegate {
result(FlutterMethodNotImplemented) result(FlutterMethodNotImplemented)
} }
break break
case .isHidden:
if let iabController = webView?.inAppBrowserDelegate as? InAppBrowserWebViewController {
result(iabController.isHidden)
} else {
result(FlutterMethodNotImplemented)
}
break
case .getCopyBackForwardList: case .getCopyBackForwardList:
result(webView?.getCopyBackForwardList()) result(webView?.getCopyBackForwardList())
break break
@ -295,11 +302,15 @@ public class WebViewChannelDelegate : ChannelDelegate {
result(contentHeight) result(contentHeight)
} }
break break
case .zoomBy: case .getContentWidth:
// let zoomFactor = (arguments!["zoomFactor"] as! NSNumber).floatValue webView?.getContentWidth { contentWidth, error in
// let animated = arguments!["animated"] as! Bool if let error = error {
// webView?.zoomBy(zoomFactor: zoomFactor, animated: animated) print(error)
result(true) result(nil)
return
}
result(contentWidth)
}
break break
case .reloadFromOrigin: case .reloadFromOrigin:
webView?.reloadFromOrigin() webView?.reloadFromOrigin()
@ -329,57 +340,6 @@ public class WebViewChannelDelegate : ChannelDelegate {
result(nil) result(nil)
} }
break break
case .getHitTestResult:
if let webView = webView {
webView.getHitTestResult { (hitTestResult) in
result(hitTestResult.toMap())
}
}
else {
result(nil)
}
break
case .clearFocus:
webView?.clearFocus()
result(true)
break
case .setContextMenu:
if let webView = webView {
let contextMenu = arguments!["contextMenu"] as? [String: Any]
webView.contextMenu = contextMenu
result(true)
} else {
result(false)
}
break
case .requestFocusNodeHref:
if let webView = webView {
webView.requestFocusNodeHref { (value, error) in
if let err = error {
print(err.localizedDescription)
result(nil)
return
}
result(value)
}
} else {
result(nil)
}
break
case .requestImageRef:
if let webView = webView {
webView.requestImageRef { (value, error) in
if let err = error {
print(err.localizedDescription)
result(nil)
return
}
result(value)
}
} else {
result(nil)
}
break
case .getScrollX: case .getScrollX:
if let webView = webView { if let webView = webView {
webView.getScrollX { scrollX, error in webView.getScrollX { scrollX, error in
@ -558,14 +518,28 @@ public class WebViewChannelDelegate : ChannelDelegate {
break break
case .canScrollVertically: case .canScrollVertically:
if let webView = webView { if let webView = webView {
result(webView.canScrollVertically()) webView.canScrollVertically { canScrollVertically, error in
if let error = error {
print(error)
result(false)
return
}
result(canScrollVertically)
}
} else { } else {
result(false) result(false)
} }
break break
case .canScrollHorizontally: case .canScrollHorizontally:
if let webView = webView { if let webView = webView {
result(webView.canScrollHorizontally()) webView.canScrollHorizontally { canScrollHorizontally, error in
if let error = error {
print(error)
result(false)
return
}
result(canScrollHorizontally)
}
} else { } else {
result(false) result(false)
} }
@ -591,10 +565,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
break break
case .closeAllMediaPresentations: case .closeAllMediaPresentations:
if let webView = self.webView, #available(macOS 11.3, *) { if let webView = self.webView, #available(macOS 11.3, *) {
// closeAllMediaPresentations with completionHandler v15.0 makes the app crash if #available(macOS 12.0, *) {
// with error EXC_BAD_ACCESS, so use closeAllMediaPresentations v14.5 webView.closeAllMediaPresentations {
result(true)
}
} else {
webView.closeAllMediaPresentations() webView.closeAllMediaPresentations()
result(true) result(true)
}
} else { } else {
result(false) result(false)
} }

View File

@ -34,6 +34,7 @@ public enum WebViewChannelDelegateMethods: String {
case close = "close" case close = "close"
case show = "show" case show = "show"
case hide = "hide" case hide = "hide"
case isHidden = "isHidden"
case getCopyBackForwardList = "getCopyBackForwardList" case getCopyBackForwardList = "getCopyBackForwardList"
@available(*, deprecated, message: "Use FindInteractionController.findAll instead.") @available(*, deprecated, message: "Use FindInteractionController.findAll instead.")
case findAll = "findAll" case findAll = "findAll"
@ -48,17 +49,12 @@ public enum WebViewChannelDelegateMethods: String {
case resumeTimers = "resumeTimers" case resumeTimers = "resumeTimers"
case printCurrentPage = "printCurrentPage" case printCurrentPage = "printCurrentPage"
case getContentHeight = "getContentHeight" case getContentHeight = "getContentHeight"
case zoomBy = "zoomBy" case getContentWidth = "getContentWidth"
case reloadFromOrigin = "reloadFromOrigin" case reloadFromOrigin = "reloadFromOrigin"
case getOriginalUrl = "getOriginalUrl" case getOriginalUrl = "getOriginalUrl"
case getZoomScale = "getZoomScale" case getZoomScale = "getZoomScale"
case hasOnlySecureContent = "hasOnlySecureContent" case hasOnlySecureContent = "hasOnlySecureContent"
case getSelectedText = "getSelectedText" case getSelectedText = "getSelectedText"
case getHitTestResult = "getHitTestResult"
case clearFocus = "clearFocus"
case setContextMenu = "setContextMenu"
case requestFocusNodeHref = "requestFocusNodeHref"
case requestImageRef = "requestImageRef"
case getScrollX = "getScrollX" case getScrollX = "getScrollX"
case getScrollY = "getScrollY" case getScrollY = "getScrollY"
case getCertificate = "getCertificate" case getCertificate = "getCertificate"

View File

@ -22,7 +22,8 @@ public class PlatformUtil: ChannelDelegate {
switch call.method { switch call.method {
case "getSystemVersion": case "getSystemVersion":
result(ProcessInfo.processInfo.operatingSystemVersionString) let version = ProcessInfo.processInfo.operatingSystemVersion
result("\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)")
break break
case "formatDate": case "formatDate":
let date = arguments!["date"] as! Int64 let date = arguments!["date"] as! Int64

View File

@ -1,62 +0,0 @@
//
// LastTouchedAnchorOrImageJS.swift
// flutter_inappwebview
//
// Created by Lorenzo Pichilli on 16/02/21.
//
import Foundation
let LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_PLUGIN_SCRIPT_GROUP_NAME = "IN_APP_WEBVIEW_LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_PLUGIN_SCRIPT"
let LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_PLUGIN_SCRIPT = PluginScript(
groupName: LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_PLUGIN_SCRIPT_GROUP_NAME,
source: LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_SOURCE,
injectionTime: .atDocumentStart,
forMainFrameOnly: true,
requiredInAllContentWorlds: false,
messageHandlerNames: [])
let LAST_TOUCHED_ANCHOR_OR_IMAGE_JS_SOURCE = """
window.\(JAVASCRIPT_BRIDGE_NAME)._lastAnchorOrImageTouched = null;
window.\(JAVASCRIPT_BRIDGE_NAME)._lastImageTouched = null;
(function() {
document.addEventListener('touchstart', function(event) {
var target = event.target;
while (target) {
if (target.tagName === 'IMG') {
var img = target;
window.\(JAVASCRIPT_BRIDGE_NAME)._lastImageTouched = {
url: img.src
};
var parent = img.parentNode;
while (parent) {
if (parent.tagName === 'A') {
window.\(JAVASCRIPT_BRIDGE_NAME)._lastAnchorOrImageTouched = {
title: parent.textContent,
url: parent.href,
src: img.src
};
break;
}
parent = parent.parentNode;
}
return;
} else if (target.tagName === 'A') {
var link = target;
var images = link.getElementsByTagName('img');
var img = (images.length > 0) ? images[0] : null;
var imgSrc = (img != null) ? img.src : null;
window.\(JAVASCRIPT_BRIDGE_NAME)._lastImageTouched = (img != null) ? {url: imgSrc} : window.\(JAVASCRIPT_BRIDGE_NAME)._lastImageTouched;
window.\(JAVASCRIPT_BRIDGE_NAME)._lastAnchorOrImageTouched = {
title: link.textContent,
url: link.href,
src: imgSrc
};
return;
}
target = target.parentNode;
}
});
})();
"""

View File

@ -9,8 +9,6 @@ import Foundation
import WebKit import WebKit
import FlutterMacOS import FlutterMacOS
var SharedLastTouchPointTimestamp: [InAppWebView: Int64] = [:]
public class Util { public class Util {
public static func getUrlAsset(assetFilePath: String) throws -> URL { public static func getUrlAsset(assetFilePath: String) throws -> URL {
// let key = SwiftFlutterPlugin.instance?.registrar?.lookupKey(forAsset: assetFilePath) // let key = SwiftFlutterPlugin.instance?.registrar?.lookupKey(forAsset: assetFilePath)

View File

@ -15,7 +15,7 @@ dependencies:
flutter_web_plugins: flutter_web_plugins:
sdk: flutter sdk: flutter
js: ^0.6.4 js: ^0.6.4
flutter_inappwebview_internal_annotations: ^1.0.0 flutter_inappwebview_internal_annotations: ^1.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: