Updated code docs, Fixed some missing macOS asserts, fix #1447

This commit is contained in:
Lorenzo Pichilli 2022-11-30 16:53:10 +01:00
parent 2d32eff3f0
commit fc98712f30
41 changed files with 1226 additions and 998 deletions

View File

@ -1,3 +1,9 @@
## 6.0.0-beta.19
- Updated code docs
- Fixed "Cannot Grant Permission at Android 21" [#1447](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1447)
- Fixed some missing macOS asserts
## 6.0.0-beta.18
- Fixed `InAppWebViewSettings` automatic infer if `initialSettings` is `null`
@ -158,6 +164,10 @@
- Removed `URLProtectionSpace.iosIsProxy` property
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
## 5.7.2+1
- Fixed "Cannot Grant Permission at Android 21" [#1447](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1447)
## 5.7.2
- Removed Android Hybrid Composition constraint to use the pull-to-refresh feature

View File

@ -1211,7 +1211,7 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
@Override
public void onPermissionRequest(final PermissionRequest request) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final WebViewChannelDelegate.PermissionRequestCallback callback = new WebViewChannelDelegate.PermissionRequestCallback() {
@Override
public boolean nonNullSuccess(@NonNull PermissionResponse response) {

View File

@ -34,7 +34,13 @@ abstract class Util {
final platformName = platform.getField("name")!.toStringValue();
final note = platform.getField("note")?.toStringValue();
if (note != null) {
platformNoteList.add("///**NOTE for $platformName**: $note");
final noteLines = note.split("\n");
var platformNote =
"///**NOTE for $platformName**: ${noteLines[0].trim()}";
for (int i = 1; i < noteLines.length; i++) {
platformNote += "\n///${noteLines[i].trim()}";
}
platformNoteList.add(platformNote);
}
final apiName = platform.getField("apiName")?.toStringValue();

View File

@ -45,7 +45,7 @@ void openAndClose() {
activityButton: ActivityButton(
templateImage: UIImage(systemName: "sun.max"),
extensionIdentifier:
"com.pichillilorenzo.flutter-inappwebview-6-Example.test")));
"com.pichillilorenzo.flutter-inappwebview6-example.test")));
await chromeSafariBrowser.opened.future;
expect(chromeSafariBrowser.isOpened(), true);
expect(() async {

View File

@ -451,7 +451,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example.test";
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example.test";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@ -484,7 +484,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example.test";
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example.test";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
@ -627,7 +627,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example";
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -659,7 +659,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example";
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@ -208,7 +208,7 @@ class ChromeSafariBrowser {
// ignore: deprecated_member_use_from_same_package
ChromeSafariBrowserClassOptions? options,
ChromeSafariBrowserSettings? settings}) async {
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.iOS) {
if (Util.isIOS) {
assert(url != null, 'The specified URL must not be null on iOS.');
assert(['http', 'https'].contains(url!.scheme),
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');

View File

@ -1,6 +1,5 @@
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../types/activity_button.dart';
@ -341,10 +340,9 @@ class ChromeSafariBrowserClassOptions {
Map<String, dynamic> toMap() {
Map<String, dynamic> options = {};
if (defaultTargetPlatform == TargetPlatform.android)
if (Util.isAndroid)
options.addAll(this.android?.toMap() ?? {});
else if (defaultTargetPlatform == TargetPlatform.iOS)
options.addAll(this.ios?.toMap() ?? {});
else if (Util.isIOS) options.addAll(this.ios?.toMap() ?? {});
return options;
}

View File

@ -1,7 +1,6 @@
import 'package:flutter/foundation.dart';
import 'in_app_webview/webview.dart';
import 'types/main.dart';
import 'util.dart';
///Class that represents the WebView context menu. It used by [WebView.contextMenu].
///
@ -89,11 +88,11 @@ class ContextMenuItem {
@Deprecated("Use id instead") this.iosId,
required this.title,
this.action}) {
if (defaultTargetPlatform == TargetPlatform.android) {
if (Util.isAndroid) {
// ignore: deprecated_member_use_from_same_package
this.id = this.id ?? this.androidId;
assert(this.id is int);
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
} else if (Util.isIOS) {
// ignore: deprecated_member_use_from_same_package
this.id = this.id ?? this.iosId;
}

View File

@ -8,6 +8,7 @@ import 'in_app_webview/headless_in_app_webview.dart';
import 'platform_util.dart';
import 'types/main.dart';
import 'util.dart';
import 'web_uri.dart';
///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances.
@ -519,14 +520,13 @@ class CookieManager {
}
Future<bool> _shouldUseJavascript() async {
if (kIsWeb) {
if (Util.isWeb) {
return true;
}
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
if (Util.isIOS || Util.isMacOS) {
final platformUtil = PlatformUtil.instance();
final systemVersion = await platformUtil.getSystemVersion();
return defaultTargetPlatform == TargetPlatform.iOS
return Util.isIOS
? systemVersion.compareTo("11") == -1
: systemVersion.compareTo("10.13") == -1;
}

View File

@ -972,7 +972,7 @@ class InAppBrowser {
///[permissionRequest] represents the permission request with an array of resources the web content wants to access
///and the origin of the web page which is trying to access the restricted resources.
///
///**NOTE for Android**: available only on Android 23+.
///**NOTE for Android**: available only on Android 21+.
///
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
///

View File

@ -350,10 +350,10 @@ class InAppBrowserClassOptions {
options.addAll(this.crossPlatform.toMap());
options.addAll(this.inAppWebViewGroupOptions.crossPlatform.toMap());
if (defaultTargetPlatform == TargetPlatform.android) {
if (Util.isAndroid) {
options.addAll(this.android.toMap());
options.addAll(this.inAppWebViewGroupOptions.android.toMap());
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
} else if (Util.isIOS) {
options.addAll(this.ios.toMap());
options.addAll(this.inAppWebViewGroupOptions.ios.toMap());
}
@ -380,12 +380,12 @@ class InAppBrowserClassOptions {
InAppWebViewGroupOptions();
inAppBrowserClassOptions.inAppWebViewGroupOptions.crossPlatform =
InAppWebViewOptions.fromMap(options);
if (defaultTargetPlatform == TargetPlatform.android) {
if (Util.isAndroid) {
inAppBrowserClassOptions.android =
AndroidInAppBrowserOptions.fromMap(options);
inAppBrowserClassOptions.inAppWebViewGroupOptions.android =
AndroidInAppWebViewOptions.fromMap(options);
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
} else if (Util.isIOS) {
inAppBrowserClassOptions.ios = IOSInAppBrowserOptions.fromMap(options);
inAppBrowserClassOptions.inAppWebViewGroupOptions.ios =
IOSInAppWebViewOptions.fromMap(options);

View File

@ -639,7 +639,7 @@ class _InAppWebViewState extends State<InAppWebView> {
widget.pullToRefreshController?.options.toMap() ??
PullToRefreshSettings(enabled: false).toMap();
if (kIsWeb) {
if (Util.isWeb) {
return HtmlElementView(
viewType: 'com.pichillilorenzo/flutter_inappwebview',
onPlatformViewCreated: (int viewId) {
@ -659,7 +659,7 @@ class _InAppWebViewState extends State<InAppWebView> {
_onPlatformViewCreated(viewId);
},
);
} else if (defaultTargetPlatform == TargetPlatform.android) {
} else if (Util.isAndroid) {
var useHybridComposition = (widget.initialSettings != null
? initialSettings.useHybridComposition
:
@ -710,9 +710,7 @@ class _InAppWebViewState extends State<InAppWebView> {
..create();
},
);
} else if (defaultTargetPlatform ==
TargetPlatform
.iOS /* || defaultTargetPlatform == TargetPlatform.macOS*/) {
} else if (Util.isIOS /* || Util.isMacOS*/) {
return UiKitView(
viewType: 'com.pichillilorenzo/flutter_inappwebview',
onPlatformViewCreated: _onPlatformViewCreated,

View File

@ -1976,8 +1976,7 @@ class InAppWebViewController {
args.putIfAbsent('source', () => source);
args.putIfAbsent('contentWorld', () => contentWorld?.toMap());
var data = await _channel.invokeMethod('evaluateJavascript', args);
if (data != null &&
(defaultTargetPlatform == TargetPlatform.android || kIsWeb)) {
if (data != null && (Util.isAndroid || Util.isWeb)) {
try {
// try to json decode the data coming from JavaScript
// otherwise return it as it is.
@ -2497,10 +2496,8 @@ class InAppWebViewController {
{required double zoomFactor,
@Deprecated('Use animated instead') bool? iosAnimated,
bool animated = false}) async {
assert(defaultTargetPlatform != TargetPlatform.android ||
(defaultTargetPlatform == TargetPlatform.android &&
zoomFactor > 0.01 &&
zoomFactor <= 100.0));
assert(!Util.isAndroid ||
(Util.isAndroid && zoomFactor > 0.01 && zoomFactor <= 100.0));
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('zoomFactor', () => zoomFactor);
@ -2819,8 +2816,7 @@ class InAppWebViewController {
///- 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 {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('userScript', () => userScript.toMap());
@ -2842,8 +2838,7 @@ class InAppWebViewController {
///- iOS
///- MacOS
Future<void> addUserScripts({required List<UserScript> userScripts}) async {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
for (var i = 0; i < userScripts.length; i++) {
await addUserScript(userScript: userScripts[i]);
@ -2863,8 +2858,7 @@ class InAppWebViewController {
///- iOS
///- MacOS
Future<bool> removeUserScript({required UserScript userScript}) async {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
var index = _userScripts[userScript.injectionTime]?.indexOf(userScript);
if (index == null || index == -1) {
@ -2892,8 +2886,7 @@ class InAppWebViewController {
///- iOS
///- MacOS
Future<void> removeUserScriptsByGroupName({required String groupName}) async {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
final List<UserScript> userScriptsAtDocumentStart = List.from(
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START] ?? []);
@ -2929,8 +2922,7 @@ class InAppWebViewController {
///- MacOS
Future<void> removeUserScripts(
{required List<UserScript> userScripts}) async {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
for (final userScript in userScripts) {
await removeUserScript(userScript: userScript);
@ -2948,8 +2940,7 @@ class InAppWebViewController {
///- 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 {
assert(_webview?.windowId == null ||
defaultTargetPlatform != TargetPlatform.iOS);
assert(_webview?.windowId == null || (!Util.isIOS && !Util.isMacOS));
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START]?.clear();
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_END]?.clear();
@ -3003,7 +2994,7 @@ class InAppWebViewController {
if (data == null) {
return null;
}
if (defaultTargetPlatform == TargetPlatform.android) {
if (Util.isAndroid) {
data = json.decode(data);
}
return CallAsyncJavaScriptResult(
@ -3031,9 +3022,9 @@ class InAppWebViewController {
Future<String?> saveWebArchive(
{required String filePath, bool autoname = false}) async {
if (!autoname) {
if (defaultTargetPlatform == TargetPlatform.android) {
if (Util.isAndroid) {
assert(filePath.endsWith("." + WebArchiveFormat.MHT.toNativeValue()));
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
} else if (Util.isIOS || Util.isMacOS) {
assert(filePath
.endsWith("." + WebArchiveFormat.WEBARCHIVE.toNativeValue()));
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -616,7 +616,7 @@ abstract class WebView {
///[permissionRequest] represents the permission request with an array of resources the web content wants to access
///and the origin of the web page which is trying to access the restricted resources.
///
///**NOTE for Android**: available only on Android 23+.
///**NOTE for Android**: available only on Android 21+.
///
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
///

View File

@ -3,6 +3,7 @@ import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_i
import '../in_app_webview/webview.dart';
import '../util.dart';
import 'client_cert_response_action.dart';
part 'client_cert_response.g.dart';
@ -40,7 +41,6 @@ class ClientCertResponse_ {
this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType;
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android)
assert(this.keyStoreType != null);
if (Util.isAndroid) assert(this.keyStoreType != null);
}
}

View File

@ -36,8 +36,7 @@ class ClientCertResponse {
if (this.action == ClientCertResponseAction.PROCEED)
assert(certificatePath.isNotEmpty);
this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType;
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android)
assert(this.keyStoreType != null);
if (Util.isAndroid) assert(this.keyStoreType != null);
}
///Gets a possible [ClientCertResponse] instance from a [Map] value.

View File

@ -30,6 +30,10 @@ class CreateWindowAction_ extends NavigationAction_ {
///Window features requested by the webpage.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "WKWindowFeatures",
apiUrl:
"https://developer.apple.com/documentation/webkit/wkwindowfeatures"),
MacOSPlatform(
apiName: "WKWindowFeatures",
apiUrl:
"https://developer.apple.com/documentation/webkit/wkwindowfeatures")

View File

@ -29,6 +29,7 @@ class CreateWindowAction extends NavigationAction {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWindowFeatures](https://developer.apple.com/documentation/webkit/wkwindowfeatures))
///- MacOS ([Official API - WKWindowFeatures](https://developer.apple.com/documentation/webkit/wkwindowfeatures))
WindowFeatures? windowFeatures;
CreateWindowAction(
{required this.windowId,

View File

@ -19,7 +19,7 @@ class JsAlertRequest_ {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
@SupportedPlatforms(platforms: [IOSPlatform()])
@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
bool? isMainFrame;
JsAlertRequest_(

View File

@ -22,6 +22,7 @@ class JsAlertRequest {
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? isMainFrame;
JsAlertRequest(
{this.url,

View File

@ -19,7 +19,7 @@ class JsConfirmRequest_ {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
@SupportedPlatforms(platforms: [IOSPlatform()])
@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
bool? isMainFrame;
JsConfirmRequest_(

View File

@ -22,6 +22,7 @@ class JsConfirmRequest {
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? isMainFrame;
JsConfirmRequest(
{this.url,

View File

@ -22,7 +22,7 @@ class JsPromptRequest_ {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
@SupportedPlatforms(platforms: [IOSPlatform()])
@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
bool? isMainFrame;
JsPromptRequest_(

View File

@ -25,6 +25,7 @@ class JsPromptRequest {
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? isMainFrame;
JsPromptRequest(
{this.url,

View File

@ -66,6 +66,10 @@ class NavigationAction_ {
///The type of action triggering the navigation.ì
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "WKNavigationAction.navigationType",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype"),
MacOSPlatform(
apiName: "WKNavigationAction.navigationType",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype")
@ -79,6 +83,10 @@ class NavigationAction_ {
///The frame that requested the navigation.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "WKNavigationAction.sourceFrame",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe"),
MacOSPlatform(
apiName: "WKNavigationAction.sourceFrame",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe")
@ -92,6 +100,10 @@ class NavigationAction_ {
///The frame in which to display the new content.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "WKNavigationAction.targetFrame",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe"),
MacOSPlatform(
apiName: "WKNavigationAction.targetFrame",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe")
@ -103,6 +115,11 @@ class NavigationAction_ {
IOSPlatform(
available: "14.5",
apiName: "WKNavigationAction.shouldPerformDownload",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload"),
MacOSPlatform(
available: "11.3",
apiName: "WKNavigationAction.shouldPerformDownload",
apiUrl:
"https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload")
])

View File

@ -58,6 +58,7 @@ class NavigationAction {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.navigationType](https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype))
///- MacOS ([Official API - WKNavigationAction.navigationType](https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype))
NavigationType? navigationType;
///Use [sourceFrame] instead.
@ -68,6 +69,7 @@ class NavigationAction {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.sourceFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe))
///- MacOS ([Official API - WKNavigationAction.sourceFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe))
FrameInfo? sourceFrame;
///Use [targetFrame] instead.
@ -78,12 +80,14 @@ class NavigationAction {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.targetFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe))
///- MacOS ([Official API - WKNavigationAction.targetFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe))
FrameInfo? targetFrame;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
///- MacOS 11.3+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
bool? shouldPerformDownload;
NavigationAction(
{required this.request,

View File

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../util.dart';
import '../x509_certificate/x509_certificate.dart';
import '../x509_certificate/asn1_distinguished_names.dart';
@ -47,7 +48,7 @@ class SslCertificate_ {
print(stacktrace);
}
if (defaultTargetPlatform == TargetPlatform.iOS) {
if (Util.isIOS) {
if (x509Certificate != null) {
return SslCertificate(
issuedBy: SslCertificateDName(

View File

@ -41,7 +41,7 @@ class SslCertificate {
print(e);
print(stacktrace);
}
if (defaultTargetPlatform == TargetPlatform.iOS) {
if (Util.isIOS) {
if (x509Certificate != null) {
return SslCertificate(
issuedBy: SslCertificateDName(

View File

@ -40,7 +40,7 @@ class URLCredential_ {
///The intermediate certificates of the credential, if it is a client certificate credential.
@ExchangeableObjectProperty(deserializer: _certificatesDeserializer)
@SupportedPlatforms(platforms: [IOSPlatform()])
@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
List<X509Certificate>? certificates;
///Use [persistence] instead.
@ -48,7 +48,7 @@ class URLCredential_ {
IOSURLCredentialPersistence_? iosPersistence;
///The credentials persistence setting.
@SupportedPlatforms(platforms: [IOSPlatform()])
@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
URLCredentialPersistence_? persistence;
URLCredential_(

View File

@ -23,6 +23,7 @@ class URLCredential {
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
List<X509Certificate>? certificates;
///Use [persistence] instead.
@ -33,6 +34,7 @@ class URLCredential {
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
URLCredentialPersistence? persistence;
URLCredential(
{this.username,

View File

@ -56,6 +56,10 @@ class URLProtectionSpace_ {
///The authentication method used by the receiver.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLProtectionSpace.authenticationMethod",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod"),
MacOSPlatform(
apiName: "URLProtectionSpace.authenticationMethod",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod")
@ -73,6 +77,10 @@ class URLProtectionSpace_ {
@ExchangeableObjectProperty(deserializer: _distinguishedNamesDeserializer)
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLProtectionSpace.distinguishedNames",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames"),
MacOSPlatform(
apiName: "URLProtectionSpace.distinguishedNames",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames")
@ -87,6 +95,10 @@ class URLProtectionSpace_ {
///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLProtectionSpace.receivesCredentialSecurely",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely"),
MacOSPlatform(
apiName: "URLProtectionSpace.receivesCredentialSecurely",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely")
@ -102,6 +114,10 @@ class URLProtectionSpace_ {
///The supported proxy types are listed in [URLProtectionSpaceProxyType.values].
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLProtectionSpace.proxyType",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype"),
MacOSPlatform(
apiName: "URLProtectionSpace.proxyType",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype")

View File

@ -36,6 +36,7 @@ class URLProtectionSpace {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.authenticationMethod](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod))
///- MacOS ([Official API - URLProtectionSpace.authenticationMethod](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod))
URLProtectionSpaceAuthenticationMethod? authenticationMethod;
///Use [distinguishedNames] instead.
@ -48,6 +49,7 @@ class URLProtectionSpace {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.distinguishedNames](https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames))
///- MacOS ([Official API - URLProtectionSpace.distinguishedNames](https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames))
List<X509Certificate>? distinguishedNames;
///Use [receivesCredentialSecurely] instead.
@ -59,6 +61,7 @@ class URLProtectionSpace {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.receivesCredentialSecurely](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely))
///- MacOS ([Official API - URLProtectionSpace.receivesCredentialSecurely](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely))
bool? receivesCredentialSecurely;
///Use [proxyType] instead.
@ -71,6 +74,7 @@ class URLProtectionSpace {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.proxyType](https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype))
///- MacOS ([Official API - URLProtectionSpace.proxyType](https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype))
URLProtectionSpaceProxyType? proxyType;
URLProtectionSpace(
{required this.host,

View File

@ -32,6 +32,10 @@ class URLRequest_ {
///A Boolean value indicating whether the request is allowed to use the built-in cellular radios to satisfy the request.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.allowsCellularAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/"),
MacOSPlatform(
apiName: "URLRequest.allowsCellularAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/")
@ -47,6 +51,11 @@ class URLRequest_ {
IOSPlatform(
available: "13.0",
apiName: "URLRequest.allowsConstrainedNetworkAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess"),
MacOSPlatform(
available: "10.15",
apiName: "URLRequest.allowsConstrainedNetworkAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess")
])
@ -61,6 +70,11 @@ class URLRequest_ {
IOSPlatform(
available: "13.0",
apiName: "URLRequest.allowsExpensiveNetworkAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess"),
MacOSPlatform(
available: "10.15",
apiName: "URLRequest.allowsExpensiveNetworkAccess",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess")
])
@ -73,6 +87,10 @@ class URLRequest_ {
///The requests cache policy.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.cachePolicy",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy"),
MacOSPlatform(
apiName: "URLRequest.cachePolicy",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy")
@ -86,6 +104,10 @@ class URLRequest_ {
///A Boolean value indicating whether cookies will be sent with and set for this request.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.httpShouldHandleCookies",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies"),
MacOSPlatform(
apiName: "URLRequest.httpShouldHandleCookies",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies")
@ -99,6 +121,10 @@ class URLRequest_ {
///A Boolean value indicating whether the request should transmit before the previous response is received.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.httpShouldUsePipelining",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining"),
MacOSPlatform(
apiName: "URLRequest.httpShouldUsePipelining",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining")
@ -112,6 +138,10 @@ class URLRequest_ {
///The service type associated with this request.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.networkServiceType",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype"),
MacOSPlatform(
apiName: "URLRequest.networkServiceType",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype")
@ -125,6 +155,10 @@ class URLRequest_ {
///The timeout interval of the request.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.timeoutInterval",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval"),
MacOSPlatform(
apiName: "URLRequest.timeoutInterval",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval")
@ -139,6 +173,10 @@ class URLRequest_ {
///This URL is used for the cookie same domain as main document policy.
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLRequest.mainDocumentURL",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl"),
MacOSPlatform(
apiName: "URLRequest.mainDocumentURL",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl")
@ -152,6 +190,11 @@ class URLRequest_ {
IOSPlatform(
available: "14.5",
apiName: "URLRequest.assumesHTTP3Capable",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable"),
MacOSPlatform(
available: "11.3",
apiName: "URLRequest.assumesHTTP3Capable",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable")
])
@ -164,6 +207,11 @@ class URLRequest_ {
IOSPlatform(
available: "15.0",
apiName: "URLRequest.attribution",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution"),
MacOSPlatform(
available: "12.0",
apiName: "URLRequest.attribution",
apiUrl:
"https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution")
])

View File

@ -30,6 +30,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.allowsCellularAccess](https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/))
///- MacOS ([Official API - URLRequest.allowsCellularAccess](https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/))
bool? allowsCellularAccess;
///Use [allowsConstrainedNetworkAccess] instead.
@ -40,6 +41,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS 13.0+ ([Official API - URLRequest.allowsConstrainedNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess))
///- MacOS 10.15+ ([Official API - URLRequest.allowsConstrainedNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess))
bool? allowsConstrainedNetworkAccess;
///Use [allowsExpensiveNetworkAccess] instead.
@ -50,6 +52,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS 13.0+ ([Official API - URLRequest.allowsExpensiveNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess))
///- MacOS 10.15+ ([Official API - URLRequest.allowsExpensiveNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess))
bool? allowsExpensiveNetworkAccess;
///Use [cachePolicy] instead.
@ -60,6 +63,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.cachePolicy](https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy))
///- MacOS ([Official API - URLRequest.cachePolicy](https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy))
URLRequestCachePolicy? cachePolicy;
///Use [httpShouldHandleCookies] instead.
@ -70,6 +74,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.httpShouldHandleCookies](https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies))
///- MacOS ([Official API - URLRequest.httpShouldHandleCookies](https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies))
bool? httpShouldHandleCookies;
///Use [httpShouldUsePipelining] instead.
@ -80,6 +85,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.httpShouldUsePipelining](https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining))
///- MacOS ([Official API - URLRequest.httpShouldUsePipelining](https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining))
bool? httpShouldUsePipelining;
///Use [networkServiceType] instead.
@ -90,6 +96,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.networkServiceType](https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype))
///- MacOS ([Official API - URLRequest.networkServiceType](https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype))
URLRequestNetworkServiceType? networkServiceType;
///Use [timeoutInterval] instead.
@ -100,6 +107,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.timeoutInterval](https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval))
///- MacOS ([Official API - URLRequest.timeoutInterval](https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval))
double? timeoutInterval;
///Use [mainDocumentURL] instead.
@ -111,6 +119,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.mainDocumentURL](https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl))
///- MacOS ([Official API - URLRequest.mainDocumentURL](https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl))
WebUri? mainDocumentURL;
///`true` if server endpoint is known to support HTTP/3. Enables QUIC racing
@ -119,6 +128,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - URLRequest.assumesHTTP3Capable](https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable))
///- MacOS 11.3+ ([Official API - URLRequest.assumesHTTP3Capable](https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable))
bool? assumesHTTP3Capable;
///The entities that can make a network request.
@ -127,6 +137,7 @@ class URLRequest {
///
///**Supported Platforms/Implementations**:
///- iOS 15.0+ ([Official API - URLRequest.attribution](https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution))
///- MacOS 12.0+ ([Official API - URLRequest.attribution](https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution))
URLRequestAttribution? attribution;
URLRequest(
{this.url,

View File

@ -459,9 +459,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("CANNOT_PARSE_RESPONSE");
///App Transport Security disallowed a connection because there is no secure network connection.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.appTransportSecurityRequiresSecureConnection',
@ -575,9 +572,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("SERVER_CERTIFICATE_UNTRUSTED");
///A server certificate was not signed by any root server.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.serverCertificateHasUnknownRoot',
@ -594,9 +588,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT");
///A server certificate is not yet valid.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.serverCertificateNotYetValid',
@ -757,9 +748,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("CANNOT_MOVE_FILE");
///A download task failed to decode an encoded file during the download.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.downloadDecodingFailedMidStream',
@ -776,9 +764,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("DOWNLOAD_DECODING_FAILED_MID_STREAM");
///A download task failed to decode an encoded file after downloading.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.downloadDecodingFailedToComplete',
@ -859,9 +844,6 @@ class WebResourceErrorType_ {
WebResourceErrorType_._internal("REQUEST_BODY_STREAM_EXHAUSTED");
///The shared container identifier of the URL session configuration is needed but has not been set.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.backgroundSessionRequiresSharedContainer',
@ -879,9 +861,6 @@ class WebResourceErrorType_ {
"BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER");
///An app or app extension attempted to connect to a background session that is already connected to a process.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.backgroundSessionInUseByAnotherProcess',
@ -899,9 +878,6 @@ class WebResourceErrorType_ {
"BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS");
///The app is suspended or exits while a background data task is processing.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'URLError.backgroundSessionWasDisconnected',

View File

@ -534,9 +534,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -669,9 +666,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -691,9 +685,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -878,9 +869,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -900,9 +888,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -996,9 +981,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -1018,9 +1000,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(
@ -1040,9 +1019,6 @@ class WebResourceErrorType {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
///
///**Supported Platforms/Implementations**:
///- 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 =
WebResourceErrorType._internalMultiPlatform(

View File

@ -7,6 +7,28 @@ import 'package:flutter/material.dart';
import 'debug_logging_settings.dart';
class Util {
static bool get isWeb => kIsWeb;
static bool get isAndroid =>
!isWeb && defaultTargetPlatform == TargetPlatform.android;
static bool get isIOS =>
!isWeb && defaultTargetPlatform == TargetPlatform.iOS;
static bool get isMacOS =>
!isWeb && defaultTargetPlatform == TargetPlatform.macOS;
static bool get isWindows =>
!isWeb && defaultTargetPlatform == TargetPlatform.windows;
static bool get isLinux =>
!isWeb && defaultTargetPlatform == TargetPlatform.linux;
static bool get isFuchsia =>
!isWeb && defaultTargetPlatform == TargetPlatform.fuchsia;
}
class IdGenerator {
static int _count = 0;
@ -538,7 +560,7 @@ void debugLog(
}
var maxLogMessageLength = debugLoggingSettings.maxLogMessageLength;
String message =
"(${kIsWeb ? 'Web' : defaultTargetPlatform.name}) ${name ?? className}" +
"(${Util.isWeb ? 'Web' : defaultTargetPlatform.name}) ${name ?? className}" +
(id != null ? ' ID $id' : '') +
' calling "' +
method.toString() +

View File

@ -94,8 +94,7 @@ class WebAuthenticationSession implements Disposable {
this.onComplete,
WebAuthenticationSessionSettings? initialSettings}) {
assert(url.toString().isNotEmpty);
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
if (Util.isIOS || Util.isMacOS) {
assert(['http', 'https'].contains(url.scheme),
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
}

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
version: 6.0.0-beta.18
version: 6.0.0-beta.19
homepage: https://inappwebview.dev/
repository: https://github.com/pichillilorenzo/flutter_inappwebview
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues