complete applying internal annotations to types folder

This commit is contained in:
Lorenzo Pichilli 2022-10-05 13:13:20 +02:00
parent caa5c7525e
commit cd523c9d53
99 changed files with 6248 additions and 2704 deletions

View File

@ -16,10 +16,10 @@
### BREAKING CHANGES
- On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`)
- On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`)
- All properties of `GeolocationPermissionShowPromptResponse` cannot be `null`
- Removed `URLProtectionSpace.iosIsProxy` property
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
## 5.4.4+2
@ -90,7 +90,7 @@
## 5.4.1
- Managed iOS native `detachFromEngine` flutter plugin event and updated `dispose` methods
- Managed iOS native `detachFromEngine` flutter plugin event and updated `dispose` methods
- Updated Android native `HeadlessInAppWebViewManager.dispose` and `HeadlessInAppWebView.dispose` methods
## 5.4.0+3
@ -345,7 +345,7 @@
- Renamed `toolbarTop` InAppBrowser cross-platform option to `hideToolbarTop`
- Renamed `toolbarBottom` InAppBrowser ios-specific option to `hideToolbarBottom`
- Removed `debuggingEnabled` WebView option; on Android you should use now the `AndroidInAppWebViewController.setWebContentsDebuggingEnabled(bool debuggingEnabled)` static method; on iOS, debugging is always enabled
- Removed `androidOnRequestFocus` event because it is never called
- Removed `androidOnRequestFocus` event because it is never called
- Removed `initialHeaders` WebView attribute. Use `URLRequest.headers` attribute
- Removed `headers` argument from `loadFile` WebView method
- Removed `headers` argument from `openFile` InAppBrowser method
@ -361,11 +361,11 @@
- Changed return type of `getOriginalUrl` Android-specific WebView method to `Uri`
- Changed return type of `getSafeBrowsingPrivacyPolicyUrl` Android-specific WebView method to `Uri`
- Changed type of `url` argument of `onLoadStart`, `onLoadStop`, `onLoadError`, `onLoadHttpError`, `onLoadResourceCustomScheme`, `onUpdateVisitedHistory`, `onPrint`, `onPageCommitVisible`, `androidOnSafeBrowsingHit`, `androidOnRenderProcessUnresponsive`, `androidOnRenderProcessResponsive`, `androidOnFormResubmission`, `androidOnReceivedTouchIconUrl` WebView events to `Uri`
- Changed type of `baseUrl` and `androidHistoryUrl` arguments of `loadData` WebView method and `openData` InAppBrowser method
- Changed type of `baseUrl` and `androidHistoryUrl` arguments of `loadData` WebView method and `openData` InAppBrowser method
- Changed `openUrl` InAppBrowser method to `openUrlRequest`
- Changed type of `url` argument of `openWithSystemBrowser` InAppBrowser method to `Uri`
- Changed all InAppBrowser color options type from `String` to `Color`
- Changed all ChromeSafariBrowser color options type from `String` to `Color`
- Changed all InAppBrowser color options type from `String` to `Color`
- Changed all ChromeSafariBrowser color options type from `String` to `Color`
- Updated attributes of `ShouldOverrideUrlLoadingRequest`, `ServerTrustChallenge` and `ClientCertChallenge` classes
- Changed type of `url` attribute to `Uri` for `JsAlertRequest`, `JsAlertConfirm`, `JsPromptRequest` classes

View File

@ -1182,7 +1182,7 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
@Nullable
@Override
public Integer decodeResult(@Nullable Object obj) {
return obj != null ? (Integer) ((Map<String, Object>) obj).get("action") : null;
return obj instanceof Integer ? (Integer) obj : null;
}
}
@ -1201,7 +1201,7 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
@Nullable
@Override
public Integer decodeResult(@Nullable Object obj) {
return obj != null ? (Integer) ((Map<String, Object>) obj).get("action") : null;
return obj instanceof Integer ? (Integer) obj : null;
}
}

View File

@ -3,6 +3,8 @@ library flutter_inappwebview_internal_annotations;
export 'src/exchangeable_object.dart';
export 'src/exchangeable_object_constructor.dart';
export 'src/exchangeable_object_property.dart';
export 'src/exchangeable_object_method.dart';
export 'src/exchangeable_enum.dart';
export 'src/exchangeable_enum_custom_value.dart';
export 'src/supported_platforms.dart';
export 'src/enum_supported_platforms.dart';

View File

@ -0,0 +1,3 @@
class ExchangeableEnumCustomValue {
const ExchangeableEnumCustomValue();
}

View File

@ -0,0 +1,9 @@
class ExchangeableObjectMethod {
final bool ignore;
final bool toMapMergeWith;
const ExchangeableObjectMethod({
this.ignore = false,
this.toMapMergeWith = false
});
}

View File

@ -1,20 +1,27 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "49.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.33.6+1"
version: "5.1.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "2.3.1"
async:
dependency: transitive
description:
@ -28,21 +35,7 @@ packages:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "2.1.0"
collection:
dependency: transitive
description:
@ -56,84 +49,63 @@ packages:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "3.0.2"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
version: "3.0.2"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
front_end:
version: "6.1.4"
frontend_server_client:
dependency: transitive
description:
name: front_end
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6+9"
version: "3.0.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
version: "2.1.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
version: "4.0.1"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
version: "1.0.3"
js:
dependency: transitive
description:
@ -141,34 +113,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_rpc_2:
dependency: transitive
description:
name: json_rpc_2
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.6+9"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
version: "1.0.2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.12"
meta:
dependency: transitive
description:
@ -183,48 +141,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
multi_server_socket:
dependency: transitive
description:
name: multi_server_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.13"
version: "2.0.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.10"
version: "2.1.0"
path:
dependency: transitive
description:
@ -232,20 +162,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
pool:
dependency: transitive
description:
@ -259,42 +175,42 @@ packages:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
version: "2.1.1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.9"
version: "1.4.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "3.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.9+2"
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
version: "1.0.2"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
version: "2.1.0"
source_maps:
dependency: transitive
description:
@ -322,7 +238,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "2.1.1"
string_scanner:
dependency: transitive
description:
@ -343,7 +259,21 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
version: "1.21.6"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.14"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.18"
typed_data:
dependency: transitive
description:
@ -351,26 +281,33 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vm_service_client:
vm_service:
dependency: transitive
description:
name: vm_service_client
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6+3"
version: "9.4.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
yaml:
dependency: transitive
@ -378,6 +315,6 @@ packages:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "3.1.1"
sdks:
dart: ">=2.16.0-100.0.dev <3.0.0"
dart: ">=2.18.0 <3.0.0"

View File

@ -7,4 +7,4 @@ environment:
sdk: ">=2.14.0 <3.0.0"
dev_dependencies:
test: 1.3.4
test: ^1.21.6

View File

@ -11,6 +11,8 @@ import 'util.dart';
final _coreCheckerEnumSupportedPlatforms =
const TypeChecker.fromRuntime(EnumSupportedPlatforms);
final _coreCheckerDeprecated = const TypeChecker.fromRuntime(Deprecated);
final _coreCheckerEnumCustomValue =
const TypeChecker.fromRuntime(ExchangeableEnumCustomValue);
class ExchangeableEnumGenerator
extends GeneratorForAnnotation<ExchangeableEnum> {
@ -21,25 +23,25 @@ class ExchangeableEnumGenerator
// Visits all the children of element in no particular order.
element.visitChildren(visitor);
final className = visitor.constructor.returnType.element.name;
final className = visitor.constructor.returnType.element2.name;
// remove "_" to generate the correct class name
final extClassName = className.replaceFirst("_", "");
final classBuffer = StringBuffer();
final classDocs =
visitor.constructor.returnType.element.documentationComment;
visitor.constructor.returnType.element2.documentationComment;
if (classDocs != null) {
classBuffer.writeln(classDocs);
}
final classSupportedDocs = Util.getSupportedDocs(
_coreCheckerEnumSupportedPlatforms,
visitor.constructor.returnType.element);
visitor.constructor.returnType.element2);
if (classSupportedDocs != null) {
classBuffer.writeln(classSupportedDocs);
}
if (visitor.constructor.returnType.element.hasDeprecated) {
if (visitor.constructor.returnType.element2.hasDeprecated) {
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element)?.getField("message")?.toStringValue()}')");
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element2)?.getField("message")?.toStringValue()}')");
}
classBuffer.writeln('class $extClassName {');
@ -66,6 +68,38 @@ class ExchangeableEnumGenerator
if (fieldName == "_value" || fieldName == "_nativeValue") {
continue;
}
final isEnumCustomValue = _coreCheckerEnumCustomValue
.firstAnnotationOf(fieldElement) != null;
if (isEnumCustomValue) {
ParsedLibraryResult parsed = fieldElement.session
?.getParsedLibraryByElement(fieldElement.library)
as ParsedLibraryResult;
final fieldBody = parsed
.getElementDeclaration(fieldElement)
?.node
.toString()
.replaceAll(className, extClassName);
if (fieldBody != null) {
final docs = fieldElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
}
if (fieldElement.isStatic) {
classBuffer.write("static ");
}
if (fieldElement.isLate) {
classBuffer.write("late ");
}
if (fieldElement.isFinal) {
classBuffer.write("final ");
}
if (fieldElement.isConst) {
classBuffer.write("const ");
}
classBuffer.writeln("$fieldBody;");
}
continue;
}
final docs = fieldElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
@ -145,14 +179,17 @@ class ExchangeableEnumGenerator
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && fieldElement.isStatic) {
final isEnumCustomValue = _coreCheckerEnumCustomValue
.firstAnnotationOf(fieldElement) != null;
if (!fieldElement.isPrivate && fieldElement.isStatic && !isEnumCustomValue) {
classBuffer.writeln('$extClassName.$fieldName,');
}
}
classBuffer.writeln('].toSet();');
}
if (annotation.read("fromValueMethod").boolValue && !visitor.methods.containsKey("fromValue")) {
if (annotation.read("fromValueMethod").boolValue && (!visitor.methods.containsKey("fromValue") ||
Util.methodHasIgnore(visitor.methods['fromNativeValue']!))) {
final hasBitwiseOrOperator =
annotation.read("bitwiseOrOperator").boolValue;
classBuffer.writeln("""
@ -171,7 +208,8 @@ class ExchangeableEnumGenerator
""");
}
if (annotation.read("fromNativeValueMethod").boolValue && !visitor.methods.containsKey("fromNativeValue")) {
if (annotation.read("fromNativeValueMethod").boolValue && (!visitor.methods.containsKey("fromNativeValue") ||
Util.methodHasIgnore(visitor.methods['fromNativeValue']!))) {
final hasBitwiseOrOperator =
annotation.read("bitwiseOrOperator").boolValue;
classBuffer.writeln("""
@ -192,8 +230,13 @@ class ExchangeableEnumGenerator
for (final entry in visitor.methods.entries) {
final methodElement = entry.value;
if (Util.methodHasIgnore(methodElement)) {
continue;
}
ParsedLibraryResult parsed = methodElement.session?.getParsedLibraryByElement(methodElement.library) as ParsedLibraryResult;
final methodBody = parsed.getElementDeclaration(methodElement)?.node;
final methodBody = parsed.getElementDeclaration(methodElement)?.node
.toString()
.replaceAll(className, extClassName);
if (methodBody != null) {
final docs = methodElement.documentationComment;
if (docs != null) {
@ -208,21 +251,24 @@ class ExchangeableEnumGenerator
}
}
if (annotation.read("toValueMethod").boolValue && !visitor.methods.containsKey("toValue")) {
if (annotation.read("toValueMethod").boolValue && (!visitor.methods.containsKey("toValue") ||
Util.methodHasIgnore(visitor.methods['toValue']!))) {
classBuffer.writeln("""
///Gets [${enumValue.type}] value.
${enumValue.type} toValue() => _value;
""");
}
if (annotation.read("toNativeValueMethod").boolValue && !visitor.methods.containsKey("toNativeValue")) {
if (annotation.read("toNativeValueMethod").boolValue && (!visitor.methods.containsKey("toNativeValue") ||
Util.methodHasIgnore(visitor.methods['toNativeValue']!))) {
classBuffer.writeln("""
///Gets [${enumNativeValue.type}] native value.
${enumNativeValue.type} toNativeValue() => _nativeValue;
""");
}
if (annotation.read("hashCodeMethod").boolValue && !visitor.fields.containsKey("hashCode")) {
if (annotation.read("hashCodeMethod").boolValue && (!visitor.fields.containsKey("hashCode") ||
Util.methodHasIgnore(visitor.methods['hashCode']!))) {
classBuffer.writeln("""
@override
int get hashCode => _value.hashCode;
@ -241,7 +287,8 @@ class ExchangeableEnumGenerator
"$extClassName operator |($extClassName value) => $extClassName._internal(value.toValue() | _value, value.toNativeValue() | _nativeValue);");
}
if (annotation.read("toStringMethod").boolValue && !visitor.methods.containsKey("toString")) {
if (annotation.read("toStringMethod").boolValue && (!visitor.methods.containsKey("toString") ||
Util.methodHasIgnore(visitor.methods['toString']!))) {
classBuffer.writeln('@override');
classBuffer.writeln('String toString() {');
if (enumValue.type.isDartCoreString) {

View File

@ -13,6 +13,8 @@ final _coreCheckerObjectConstructor =
const TypeChecker.fromRuntime(ExchangeableObjectConstructor);
final _coreCheckerObjectProperty =
const TypeChecker.fromRuntime(ExchangeableObjectProperty);
final _coreCheckerObjectMethod =
const TypeChecker.fromRuntime(ExchangeableObjectMethod);
final _coreCheckerEnum = const TypeChecker.fromRuntime(ExchangeableEnum);
final _coreCheckerDeprecated = const TypeChecker.fromRuntime(Deprecated);
final _coreCheckerSupportedPlatforms =
@ -27,32 +29,36 @@ class ExchangeableObjectGenerator
// Visits all the children of element in no particular order.
element.visitChildren(visitor);
final className = visitor.constructor.returnType.element.name;
final className = visitor.constructor.returnType.element2.name;
final superClass =
visitor.constructor.returnType.superclass?.element.name != 'Object'
visitor.constructor.returnType.superclass?.element2.name != 'Object'
? visitor.constructor.returnType.superclass
: null;
final superClassName = superClass?.element.name.replaceFirst("_", "");
final interfaces = visitor.constructor.returnType.interfaces;
final superClassName = superClass?.element2.name.replaceFirst("_", "");
// remove "_" to generate the correct class name
final extClassName = className.replaceFirst("_", "");
final classBuffer = StringBuffer();
final classDocs =
visitor.constructor.returnType.element.documentationComment;
visitor.constructor.returnType.element2.documentationComment;
if (classDocs != null) {
classBuffer.writeln(classDocs);
}
final classSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms, visitor.constructor.returnType.element);
_coreCheckerSupportedPlatforms, visitor.constructor.returnType.element2);
if (classSupportedDocs != null) {
classBuffer.writeln(classSupportedDocs);
}
if (visitor.constructor.returnType.element.hasDeprecated) {
if (visitor.constructor.returnType.element2.hasDeprecated) {
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element)?.getField("message")?.toStringValue()}')");
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element2)?.getField("message")?.toStringValue()}')");
}
classBuffer.write('class $extClassName');
classBuffer.write('${(visitor.constructor.enclosingElement3 as ClassElement).isAbstract ? 'abstract ' : ''}class $extClassName');
if (interfaces.isNotEmpty) {
classBuffer.writeln(' implements ${interfaces.map((i) => i.element2.name.replaceFirst("_", "")).join(', ')}');
}
if (superClass != null) {
classBuffer.writeln(' extends ${superClassName}');
}
@ -98,6 +104,9 @@ class ExchangeableObjectGenerator
if (fieldElement.isStatic) {
classBuffer.write("static ");
}
if (fieldElement.isLate) {
classBuffer.write("late ");
}
if (fieldElement.isFinal) {
classBuffer.write("final ");
}
@ -155,7 +164,7 @@ class ExchangeableObjectGenerator
if (constructorSupportedDocs == null) {
constructorSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms,
visitor.constructor.returnType.element);
visitor.constructor.returnType.element2);
}
if (constructorSupportedDocs != null) {
classBuffer.writeln(constructorSupportedDocs);
@ -214,12 +223,17 @@ class ExchangeableObjectGenerator
.trim();
final fieldElement = visitor.fields[fieldName];
if (fieldElement != null) {
final fieldTypeElement = fieldElement.type.element;
final deprecatedFieldTypeElement = deprecatedField.type.element;
final fieldTypeElement = fieldElement.type.element2;
final deprecatedFieldTypeElement = deprecatedField.type.element2;
final isNullable = Util.typeIsNullable(fieldElement.type);
var hasDefaultValue = (fieldElement is ParameterElement) ? (fieldElement as ParameterElement).hasDefaultValue : false;
if (!isNullable && hasDefaultValue) {
continue;
}
classBuffer.write('$fieldName = $fieldName ?? ');
if (fieldTypeElement != null && deprecatedFieldTypeElement != null) {
final isNullable = Util.typeIsNullable(fieldElement.type);
final deprecatedIsNullable =
Util.typeIsNullable(deprecatedField.type);
final hasFromMap = hasFromMapMethod(fieldTypeElement);
@ -257,8 +271,8 @@ class ExchangeableObjectGenerator
classBuffer.writeln(';');
}
if (annotation.read("fromMapFactory").boolValue &&
!visitor.methods.containsKey("fromMap")) {
if (annotation.read("fromMapFactory").boolValue && (!visitor.methods.containsKey("fromMap") ||
Util.methodHasIgnore(visitor.methods['fromMap']!))) {
classBuffer.writeln(
'///Gets a possible [$extClassName] instance from a [Map] value.');
final nullable = annotation.read("nullableFromMapFactory").boolValue;
@ -272,7 +286,7 @@ class ExchangeableObjectGenerator
classBuffer.writeln('final instance = $extClassName(');
final fieldElements = <FieldElement>[];
if (superClass != null) {
fieldElements.addAll(superClass.element.fields);
fieldElements.addAll(superClass.element2.fields);
}
fieldElements.addAll(visitor.fields.values);
final nonRequiredFields = <String>[];
@ -301,7 +315,7 @@ class ExchangeableObjectGenerator
?.toFunctionValue();
if (customDeserializer != null) {
final deserializerClassName =
customDeserializer.enclosingElement.name;
customDeserializer.enclosingElement3.name;
if (deserializerClassName != null) {
value =
"$deserializerClassName.${customDeserializer.name}($value)";
@ -334,6 +348,9 @@ class ExchangeableObjectGenerator
for (final entry in visitor.methods.entries) {
final methodElement = entry.value;
if (Util.methodHasIgnore(methodElement)) {
continue;
}
ParsedLibraryResult parsed = methodElement.session
?.getParsedLibraryByElement(methodElement.library)
as ParsedLibraryResult;
@ -353,14 +370,24 @@ class ExchangeableObjectGenerator
}
}
if (annotation.read("toMapMethod").boolValue &&
!visitor.methods.containsKey("toMap")) {
if (annotation.read("toMapMethod").boolValue && (!visitor.methods.containsKey("toMap") ||
Util.methodHasIgnore(visitor.methods['toMap']!))) {
classBuffer.writeln('///Converts instance to a map.');
classBuffer.writeln('Map<String, dynamic> toMap() {');
classBuffer.writeln('return {');
for (final entry in visitor.methods.entries) {
final methodElement = entry.value;
final toMapMergeWith = _coreCheckerObjectMethod
.firstAnnotationOf(methodElement)
?.getField("toMapMergeWith")
?.toBoolValue();
if (toMapMergeWith == true) {
classBuffer.writeln('...${methodElement.name}(),');
}
}
final fieldElements = <FieldElement>[];
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
for (final fieldElement in superClass.element2.fields) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
@ -390,7 +417,7 @@ class ExchangeableObjectGenerator
?.getField("serializer")
?.toFunctionValue();
if (customSerializer != null) {
final serializerClassName = customSerializer.enclosingElement.name;
final serializerClassName = customSerializer.enclosingElement3.name;
if (serializerClassName != null) {
mapValue =
"$serializerClassName.${customSerializer.name}($mapValue)";
@ -408,22 +435,22 @@ class ExchangeableObjectGenerator
classBuffer.writeln('}');
}
if (annotation.read("toJsonMethod").boolValue &&
!visitor.methods.containsKey("toJson")) {
if (annotation.read("toJsonMethod").boolValue && (!visitor.methods.containsKey("toJson") ||
Util.methodHasIgnore(visitor.methods['toJson']!))) {
classBuffer.writeln('///Converts instance to a map.');
classBuffer.writeln('Map<String, dynamic> toJson() {');
classBuffer.writeln('return toMap();');
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']!))) {
classBuffer.writeln('@override');
classBuffer.writeln('String toString() {');
classBuffer.write('return \'$extClassName{');
final fieldNames = <String>[];
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
for (final fieldElement in superClass.element2.fields) {
final fieldName = fieldElement.name;
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
@ -453,7 +480,7 @@ class ExchangeableObjectGenerator
}
String getFromMapValue(String value, DartType elementType) {
final fieldTypeElement = elementType.element;
final fieldTypeElement = elementType.element2;
final isNullable = Util.typeIsNullable(elementType);
if (elementType.getDisplayString(withNullability: false) == "Uri") {
if (!isNullable) {
@ -486,9 +513,9 @@ class ExchangeableObjectGenerator
final genericTypeFieldName = 'e';
return value +
(isNullable ? '?' : '') +
'.forEach(($genericTypeFieldName) => ' +
'.map(($genericTypeFieldName) => ' +
getFromMapValue('$genericTypeFieldName', genericType) +
')';
')${elementType.isDartCoreSet ? '.toSet()' : ''}';
} else {
return value;
}
@ -523,7 +550,7 @@ class ExchangeableObjectGenerator
}
String getToMapValue(String fieldName, DartType elementType) {
final fieldTypeElement = elementType.element;
final fieldTypeElement = elementType.element2;
final isNullable = Util.typeIsNullable(elementType);
if (elementType.getDisplayString(withNullability: false) == "Uri") {
return fieldName + (isNullable ? '?' : '') + '.toString()';

View File

@ -3,6 +3,10 @@ import 'package:source_gen/source_gen.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
final _coreCheckerObjectMethod =
const TypeChecker.fromRuntime(ExchangeableObjectMethod);
abstract class Util {
static bool typeIsNullable(DartType type) {
@ -10,6 +14,14 @@ abstract class Util {
type.toString() == 'dynamic';
}
static bool methodHasIgnore(MethodElement method) {
return _coreCheckerObjectMethod
.firstAnnotationOf(method)
?.getField("ignore")
?.toBoolValue() ==
true;
}
static String? getSupportedDocs(TypeChecker checker, Element element) {
final platformNoteList = <String>[];
final platformSupportedList = <String>[];
@ -64,7 +76,7 @@ abstract class Util {
}
static bool canHaveGenerics(DartType type) {
final element = type.element;
final element = type.element2;
if (element is ClassElement) {
return element.typeParameters.isNotEmpty;
}

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "39.0.0"
version: "49.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "5.1.0"
args:
dependency: transitive
description:
@ -42,14 +42,14 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0"
build_daemon:
dependency: transitive
description:
@ -63,21 +63,21 @@ packages:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.0.10"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
version: "2.2.1"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
version: "7.2.4"
build_test:
dependency: "direct dev"
description:
@ -98,21 +98,14 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
version: "8.4.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
checked_yaml:
dependency: transitive
description:
@ -126,28 +119,28 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.3.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.6.1"
crypto:
dependency: transitive
description:
@ -161,21 +154,21 @@ packages:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
version: "0.17.2"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
version: "2.2.4"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
version: "6.1.4"
fixnum:
dependency: transitive
description:
@ -201,14 +194,14 @@ packages:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.3"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
graphs:
dependency: transitive
description:
@ -229,14 +222,14 @@ packages:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
io:
dependency: transitive
description:
@ -257,7 +250,7 @@ packages:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
version: "4.7.0"
logging:
dependency: transitive
description:
@ -271,21 +264,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mime:
dependency: transitive
description:
@ -306,21 +299,21 @@ packages:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
version: "1.5.1"
pub_semver:
dependency: transitive
description:
@ -334,35 +327,35 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.4.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
sky_engine:
dependency: transitive
description: flutter
@ -374,7 +367,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.5"
source_map_stack_trace:
dependency: transitive
description:
@ -395,7 +388,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.9.1"
stack_trace:
dependency: transitive
description:
@ -409,7 +402,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
stream_transform:
dependency: transitive
description:
@ -430,28 +423,28 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.1"
version: "1.21.6"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.14"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.13"
version: "0.4.18"
timing:
dependency: transitive
description:
@ -465,21 +458,21 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
version: "9.4.0"
watcher:
dependency: transitive
description:
@ -500,7 +493,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.2.0"
yaml:
dependency: transitive
description:
@ -509,5 +502,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.16.0 <3.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -10,12 +10,12 @@ environment:
dependencies:
flutter:
sdk: flutter
build:
source_gen:
build: ^2.3.1
source_gen: ^1.2.5
flutter_inappwebview_internal_annotations:
path: ../flutter_inappwebview_internal_annotations/
dev_dependencies:
build_runner:
build_test:
build_runner: ^2.2.1
build_test: ^2.1.5
test: ^1.21.1

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "39.0.0"
version: "49.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "5.1.0"
args:
dependency: transitive
description:
@ -35,14 +35,14 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0"
build_daemon:
dependency: transitive
description:
@ -56,21 +56,21 @@ packages:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.0.10"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
version: "2.2.1"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
version: "7.2.4"
built_collection:
dependency: transitive
description:
@ -84,21 +84,14 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
version: "8.4.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
checked_yaml:
dependency: transitive
description:
@ -112,21 +105,21 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.3.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
crypto:
dependency: transitive
description:
@ -140,14 +133,14 @@ packages:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
version: "2.2.4"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
version: "6.1.4"
fixnum:
dependency: transitive
description:
@ -173,7 +166,7 @@ packages:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.3"
generators:
dependency: "direct dev"
description:
@ -187,7 +180,7 @@ packages:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
graphs:
dependency: transitive
description:
@ -201,14 +194,14 @@ packages:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
io:
dependency: transitive
description:
@ -229,7 +222,7 @@ packages:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
version: "4.7.0"
lints:
dependency: "direct dev"
description:
@ -250,21 +243,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mime:
dependency: transitive
description:
@ -278,21 +271,21 @@ packages:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
version: "1.5.1"
pub_semver:
dependency: transitive
description:
@ -306,21 +299,21 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.4.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
sky_engine:
dependency: transitive
description: flutter
@ -332,14 +325,14 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.5"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.9.1"
stack_trace:
dependency: transitive
description:
@ -353,7 +346,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
stream_transform:
dependency: transitive
description:
@ -374,7 +367,7 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
timing:
dependency: transitive
description:
@ -388,14 +381,14 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
watcher:
dependency: transitive
description:
@ -418,5 +411,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.16.0 <3.0.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -14,7 +14,7 @@ dependencies:
path: ../flutter_inappwebview_internal_annotations/
dev_dependencies:
build_runner:
build_runner: ^2.2.1
generators:
path: ../generators/
lints: ^1.0.1

Binary file not shown.

View File

@ -1007,7 +1007,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
override init() {
super.init()
self.decodeResult = { (obj: Any?) in
if let obj = obj as? [String: Any?], let action = obj["action"] as? Int {
if let action = obj as? Int {
return action == 1
}
return false

View File

@ -1,3 +1,3 @@
export 'service_worker_controller.dart';
export 'webview_feature.dart';
export 'webview_feature.dart' show WebViewFeature, AndroidWebViewFeature;
export 'proxy_controller.dart';

View File

@ -1,255 +1,198 @@
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_controller.dart';
import '../in_app_webview/in_app_webview_settings.dart';
import 'proxy_controller.dart';
import 'service_worker_controller.dart';
import '../web_message/main.dart';
part 'webview_feature.g.dart';
///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device.
class WebViewFeature {
@ExchangeableEnum()
class WebViewFeature_ {
@ExchangeableEnumCustomValue()
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
// ignore: unused_field
final String _value;
const WebViewFeature_._internal(this._value);
const WebViewFeature._internal(this._value);
static final Set<WebViewFeature> values = [
WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
WebViewFeature.FORCE_DARK,
WebViewFeature.FORCE_DARK_STRATEGY,
WebViewFeature.GET_WEB_CHROME_CLIENT,
WebViewFeature.GET_WEB_VIEW_CLIENT,
WebViewFeature.GET_WEB_VIEW_RENDERER,
WebViewFeature.MULTI_PROCESS,
WebViewFeature.OFF_SCREEN_PRERASTER,
WebViewFeature.POST_WEB_MESSAGE,
WebViewFeature.PROXY_OVERRIDE,
WebViewFeature.RECEIVE_HTTP_ERROR,
WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
WebViewFeature.SAFE_BROWSING_ALLOWLIST,
WebViewFeature.SAFE_BROWSING_ENABLE,
WebViewFeature.SAFE_BROWSING_HIT,
WebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL,
WebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY,
WebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED,
WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL,
WebViewFeature.SERVICE_WORKER_BASIC_USAGE,
WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS,
WebViewFeature.SERVICE_WORKER_CACHE_MODE,
WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS,
WebViewFeature.SERVICE_WORKER_FILE_ACCESS,
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
WebViewFeature.START_SAFE_BROWSING,
WebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
WebViewFeature.VISUAL_STATE_CALLBACK,
WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
WebViewFeature.WEB_MESSAGE_LISTENER,
WebViewFeature.WEB_MESSAGE_PORT_CLOSE,
WebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE,
WebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK,
WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE,
WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION,
WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
WebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
].toSet();
static WebViewFeature? fromValue(String? value) {
if (value != null) {
try {
return WebViewFeature.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
@ExchangeableObjectMethod(ignore: true)
String toValue() => _value;
@override
String toString() => _value;
///This feature covers [InAppWebViewController.createWebMessageChannel].
static const CREATE_WEB_MESSAGE_CHANNEL =
const WebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL");
const WebViewFeature_._internal("CREATE_WEB_MESSAGE_CHANNEL");
///This feature covers [InAppWebViewSettings.disabledActionModeMenuItems].
static const DISABLED_ACTION_MODE_MENU_ITEMS =
const WebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
const WebViewFeature_._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
///This feature covers [InAppWebViewSettings.forceDark].
static const FORCE_DARK = const WebViewFeature._internal("FORCE_DARK");
static const FORCE_DARK = const WebViewFeature_._internal("FORCE_DARK");
///This feature covers [InAppWebViewSettings.forceDarkStrategy].
static const FORCE_DARK_STRATEGY =
const WebViewFeature._internal("FORCE_DARK_STRATEGY");
const WebViewFeature_._internal("FORCE_DARK_STRATEGY");
///
static const GET_WEB_CHROME_CLIENT =
const WebViewFeature._internal("GET_WEB_CHROME_CLIENT");
const WebViewFeature_._internal("GET_WEB_CHROME_CLIENT");
///
static const GET_WEB_VIEW_CLIENT =
const WebViewFeature._internal("GET_WEB_VIEW_CLIENT");
const WebViewFeature_._internal("GET_WEB_VIEW_CLIENT");
///
static const GET_WEB_VIEW_RENDERER =
const WebViewFeature._internal("GET_WEB_VIEW_RENDERER");
const WebViewFeature_._internal("GET_WEB_VIEW_RENDERER");
///
static const MULTI_PROCESS = const WebViewFeature._internal("MULTI_PROCESS");
static const MULTI_PROCESS = const WebViewFeature_._internal("MULTI_PROCESS");
///This feature covers [InAppWebViewSettings.offscreenPreRaster].
static const OFF_SCREEN_PRERASTER =
const WebViewFeature._internal("OFF_SCREEN_PRERASTER");
const WebViewFeature_._internal("OFF_SCREEN_PRERASTER");
///This feature covers [InAppWebViewController.postWebMessage].
static const POST_WEB_MESSAGE =
const WebViewFeature._internal("POST_WEB_MESSAGE");
const WebViewFeature_._internal("POST_WEB_MESSAGE");
///This feature covers [ProxyController.setProxyOverride] and [ProxyController.clearProxyOverride].
static const PROXY_OVERRIDE =
const WebViewFeature._internal("PROXY_OVERRIDE");
const WebViewFeature_._internal("PROXY_OVERRIDE");
///
static const RECEIVE_HTTP_ERROR =
const WebViewFeature._internal("RECEIVE_HTTP_ERROR");
const WebViewFeature_._internal("RECEIVE_HTTP_ERROR");
///
static const RECEIVE_WEB_RESOURCE_ERROR =
const WebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR");
const WebViewFeature_._internal("RECEIVE_WEB_RESOURCE_ERROR");
///This feature covers [InAppWebViewController.setSafeBrowsingAllowlist].
static const SAFE_BROWSING_ALLOWLIST =
const WebViewFeature._internal("SAFE_BROWSING_ALLOWLIST");
const WebViewFeature_._internal("SAFE_BROWSING_ALLOWLIST");
///This feature covers [InAppWebViewSettings.safeBrowsingEnabled].
static const SAFE_BROWSING_ENABLE =
const WebViewFeature._internal("SAFE_BROWSING_ENABLE");
const WebViewFeature_._internal("SAFE_BROWSING_ENABLE");
///
static const SAFE_BROWSING_HIT =
const WebViewFeature._internal("SAFE_BROWSING_HIT");
const WebViewFeature_._internal("SAFE_BROWSING_HIT");
///This feature covers [InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl].
static const SAFE_BROWSING_PRIVACY_POLICY_URL =
const WebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
const WebViewFeature_._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
///
static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY =
const WebViewFeature._internal("SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY");
const WebViewFeature_._internal("SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY");
///
static const SAFE_BROWSING_RESPONSE_PROCEED =
const WebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED");
const WebViewFeature_._internal("SAFE_BROWSING_RESPONSE_PROCEED");
///
static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
const WebViewFeature._internal(
const WebViewFeature_._internal(
"SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL");
///Use [SAFE_BROWSING_ALLOWLIST] instead.
@Deprecated('Use SAFE_BROWSING_ALLOWLIST instead')
static const SAFE_BROWSING_WHITELIST =
const WebViewFeature._internal("SAFE_BROWSING_WHITELIST");
const WebViewFeature_._internal("SAFE_BROWSING_WHITELIST");
///This feature covers [ServiceWorkerController].
static const SERVICE_WORKER_BASIC_USAGE =
const WebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE");
const WebViewFeature_._internal("SERVICE_WORKER_BASIC_USAGE");
///This feature covers [ServiceWorkerController.setBlockNetworkLoads] and [ServiceWorkerController.getBlockNetworkLoads].
static const SERVICE_WORKER_BLOCK_NETWORK_LOADS =
const WebViewFeature._internal("SERVICE_WORKER_BLOCK_NETWORK_LOADS");
const WebViewFeature_._internal("SERVICE_WORKER_BLOCK_NETWORK_LOADS");
///This feature covers [ServiceWorkerController.setCacheMode] and [ServiceWorkerController.getCacheMode].
static const SERVICE_WORKER_CACHE_MODE =
const WebViewFeature._internal("SERVICE_WORKER_CACHE_MODE");
const WebViewFeature_._internal("SERVICE_WORKER_CACHE_MODE");
///This feature covers [ServiceWorkerController.setAllowContentAccess] and [ServiceWorkerController.getAllowContentAccess].
static const SERVICE_WORKER_CONTENT_ACCESS =
const WebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS");
const WebViewFeature_._internal("SERVICE_WORKER_CONTENT_ACCESS");
///This feature covers [ServiceWorkerController.setAllowFileAccess] and [ServiceWorkerController.getAllowFileAccess].
static const SERVICE_WORKER_FILE_ACCESS =
const WebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS");
const WebViewFeature_._internal("SERVICE_WORKER_FILE_ACCESS");
///This feature covers [ServiceWorkerClient.shouldInterceptRequest].
static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST =
const WebViewFeature._internal("SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST");
const WebViewFeature_._internal("SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST");
///
static const SHOULD_OVERRIDE_WITH_REDIRECTS =
const WebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
const WebViewFeature_._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
///This feature covers [InAppWebViewController.startSafeBrowsing].
static const START_SAFE_BROWSING =
const WebViewFeature._internal("START_SAFE_BROWSING");
const WebViewFeature_._internal("START_SAFE_BROWSING");
///
static const TRACING_CONTROLLER_BASIC_USAGE =
const WebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE");
const WebViewFeature_._internal("TRACING_CONTROLLER_BASIC_USAGE");
///
static const VISUAL_STATE_CALLBACK =
const WebViewFeature._internal("VISUAL_STATE_CALLBACK");
const WebViewFeature_._internal("VISUAL_STATE_CALLBACK");
///
static const WEB_MESSAGE_CALLBACK_ON_MESSAGE =
const WebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
const WebViewFeature_._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
///This feature covers [WebMessageListener].
static const WEB_MESSAGE_LISTENER =
const WebViewFeature._internal("WEB_MESSAGE_LISTENER");
const WebViewFeature_._internal("WEB_MESSAGE_LISTENER");
///
static const WEB_MESSAGE_PORT_CLOSE =
const WebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE");
const WebViewFeature_._internal("WEB_MESSAGE_PORT_CLOSE");
///
static const WEB_MESSAGE_PORT_POST_MESSAGE =
const WebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
const WebViewFeature_._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
///
static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK =
const WebViewFeature._internal("WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK");
const WebViewFeature_._internal("WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK");
///
static const WEB_RESOURCE_ERROR_GET_CODE =
const WebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE");
const WebViewFeature_._internal("WEB_RESOURCE_ERROR_GET_CODE");
///
static const WEB_RESOURCE_ERROR_GET_DESCRIPTION =
const WebViewFeature._internal("WEB_RESOURCE_ERROR_GET_DESCRIPTION");
const WebViewFeature_._internal("WEB_RESOURCE_ERROR_GET_DESCRIPTION");
///
static const WEB_RESOURCE_REQUEST_IS_REDIRECT =
const WebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
const WebViewFeature_._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
///
static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE =
const WebViewFeature._internal("WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE");
const WebViewFeature_._internal("WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE");
///
static const WEB_VIEW_RENDERER_TERMINATE =
const WebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const WebViewFeature_._internal("WEB_VIEW_RENDERER_TERMINATE");
///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher,
///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device,
///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isFeatureSupported(WebViewFeature feature) async {
static Future<bool> isFeatureSupported(WebViewFeature_ feature) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args);
@ -259,256 +202,196 @@ class WebViewFeature {
///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device.
///Use [WebViewFeature] instead.
@Deprecated("Use WebViewFeature instead")
class AndroidWebViewFeature {
@ExchangeableEnum()
class AndroidWebViewFeature_ {
@ExchangeableEnumCustomValue()
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
// ignore: unused_field
final String _value;
const AndroidWebViewFeature_._internal(this._value);
const AndroidWebViewFeature._internal(this._value);
static final Set<AndroidWebViewFeature> values = [
AndroidWebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
AndroidWebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
AndroidWebViewFeature.FORCE_DARK,
AndroidWebViewFeature.FORCE_DARK_STRATEGY,
AndroidWebViewFeature.GET_WEB_CHROME_CLIENT,
AndroidWebViewFeature.GET_WEB_VIEW_CLIENT,
AndroidWebViewFeature.GET_WEB_VIEW_RENDERER,
AndroidWebViewFeature.MULTI_PROCESS,
AndroidWebViewFeature.OFF_SCREEN_PRERASTER,
AndroidWebViewFeature.POST_WEB_MESSAGE,
AndroidWebViewFeature.PROXY_OVERRIDE,
AndroidWebViewFeature.RECEIVE_HTTP_ERROR,
AndroidWebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
AndroidWebViewFeature.SAFE_BROWSING_ALLOWLIST,
AndroidWebViewFeature.SAFE_BROWSING_ENABLE,
AndroidWebViewFeature.SAFE_BROWSING_HIT,
AndroidWebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL,
AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE,
AndroidWebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS,
AndroidWebViewFeature.SERVICE_WORKER_CACHE_MODE,
AndroidWebViewFeature.SERVICE_WORKER_CONTENT_ACCESS,
AndroidWebViewFeature.SERVICE_WORKER_FILE_ACCESS,
AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
AndroidWebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
AndroidWebViewFeature.START_SAFE_BROWSING,
AndroidWebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
AndroidWebViewFeature.VISUAL_STATE_CALLBACK,
AndroidWebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
AndroidWebViewFeature.WEB_MESSAGE_LISTENER,
AndroidWebViewFeature.WEB_MESSAGE_PORT_CLOSE,
AndroidWebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE,
AndroidWebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK,
AndroidWebViewFeature.WEB_RESOURCE_ERROR_GET_CODE,
AndroidWebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION,
AndroidWebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
AndroidWebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
AndroidWebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
].toSet();
static AndroidWebViewFeature? fromValue(String? value) {
if (value != null) {
try {
return AndroidWebViewFeature.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
@ExchangeableObjectMethod(ignore: true)
String toValue() => _value;
@override
String toString() => _value;
///
static const CREATE_WEB_MESSAGE_CHANNEL =
const AndroidWebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL");
const AndroidWebViewFeature_._internal("CREATE_WEB_MESSAGE_CHANNEL");
///
static const DISABLED_ACTION_MODE_MENU_ITEMS =
const AndroidWebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
const AndroidWebViewFeature_._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
///
static const FORCE_DARK = const AndroidWebViewFeature._internal("FORCE_DARK");
static const FORCE_DARK = const AndroidWebViewFeature_._internal("FORCE_DARK");
///
static const FORCE_DARK_STRATEGY =
const AndroidWebViewFeature._internal("FORCE_DARK_STRATEGY");
const AndroidWebViewFeature_._internal("FORCE_DARK_STRATEGY");
///
static const GET_WEB_CHROME_CLIENT =
const AndroidWebViewFeature._internal("GET_WEB_CHROME_CLIENT");
const AndroidWebViewFeature_._internal("GET_WEB_CHROME_CLIENT");
///
static const GET_WEB_VIEW_CLIENT =
const AndroidWebViewFeature._internal("GET_WEB_VIEW_CLIENT");
const AndroidWebViewFeature_._internal("GET_WEB_VIEW_CLIENT");
///
static const GET_WEB_VIEW_RENDERER =
const AndroidWebViewFeature._internal("GET_WEB_VIEW_RENDERER");
const AndroidWebViewFeature_._internal("GET_WEB_VIEW_RENDERER");
///
static const MULTI_PROCESS =
const AndroidWebViewFeature._internal("MULTI_PROCESS");
const AndroidWebViewFeature_._internal("MULTI_PROCESS");
///
static const OFF_SCREEN_PRERASTER =
const AndroidWebViewFeature._internal("OFF_SCREEN_PRERASTER");
const AndroidWebViewFeature_._internal("OFF_SCREEN_PRERASTER");
///
static const POST_WEB_MESSAGE =
const AndroidWebViewFeature._internal("POST_WEB_MESSAGE");
const AndroidWebViewFeature_._internal("POST_WEB_MESSAGE");
///
static const PROXY_OVERRIDE =
const AndroidWebViewFeature._internal("PROXY_OVERRIDE");
const AndroidWebViewFeature_._internal("PROXY_OVERRIDE");
///
static const RECEIVE_HTTP_ERROR =
const AndroidWebViewFeature._internal("RECEIVE_HTTP_ERROR");
const AndroidWebViewFeature_._internal("RECEIVE_HTTP_ERROR");
///
static const RECEIVE_WEB_RESOURCE_ERROR =
const AndroidWebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR");
const AndroidWebViewFeature_._internal("RECEIVE_WEB_RESOURCE_ERROR");
///
static const SAFE_BROWSING_ALLOWLIST =
const AndroidWebViewFeature._internal("SAFE_BROWSING_ALLOWLIST");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_ALLOWLIST");
///
static const SAFE_BROWSING_ENABLE =
const AndroidWebViewFeature._internal("SAFE_BROWSING_ENABLE");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_ENABLE");
///
static const SAFE_BROWSING_HIT =
const AndroidWebViewFeature._internal("SAFE_BROWSING_HIT");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_HIT");
///
static const SAFE_BROWSING_PRIVACY_POLICY_URL =
const AndroidWebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
///
static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY");
///
static const SAFE_BROWSING_RESPONSE_PROCEED =
const AndroidWebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_RESPONSE_PROCEED");
///
static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL");
///Use [SAFE_BROWSING_ALLOWLIST] instead.
@Deprecated('Use SAFE_BROWSING_ALLOWLIST instead')
static const SAFE_BROWSING_WHITELIST =
const AndroidWebViewFeature._internal("SAFE_BROWSING_WHITELIST");
const AndroidWebViewFeature_._internal("SAFE_BROWSING_WHITELIST");
///
static const SERVICE_WORKER_BASIC_USAGE =
const AndroidWebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE");
const AndroidWebViewFeature_._internal("SERVICE_WORKER_BASIC_USAGE");
///
static const SERVICE_WORKER_BLOCK_NETWORK_LOADS =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"SERVICE_WORKER_BLOCK_NETWORK_LOADS");
///
static const SERVICE_WORKER_CACHE_MODE =
const AndroidWebViewFeature._internal("SERVICE_WORKER_CACHE_MODE");
const AndroidWebViewFeature_._internal("SERVICE_WORKER_CACHE_MODE");
///
static const SERVICE_WORKER_CONTENT_ACCESS =
const AndroidWebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS");
const AndroidWebViewFeature_._internal("SERVICE_WORKER_CONTENT_ACCESS");
///
static const SERVICE_WORKER_FILE_ACCESS =
const AndroidWebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS");
const AndroidWebViewFeature_._internal("SERVICE_WORKER_FILE_ACCESS");
///
static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST");
///
static const SHOULD_OVERRIDE_WITH_REDIRECTS =
const AndroidWebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
const AndroidWebViewFeature_._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
///
static const START_SAFE_BROWSING =
const AndroidWebViewFeature._internal("START_SAFE_BROWSING");
const AndroidWebViewFeature_._internal("START_SAFE_BROWSING");
///
static const TRACING_CONTROLLER_BASIC_USAGE =
const AndroidWebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE");
const AndroidWebViewFeature_._internal("TRACING_CONTROLLER_BASIC_USAGE");
///
static const VISUAL_STATE_CALLBACK =
const AndroidWebViewFeature._internal("VISUAL_STATE_CALLBACK");
const AndroidWebViewFeature_._internal("VISUAL_STATE_CALLBACK");
///
static const WEB_MESSAGE_CALLBACK_ON_MESSAGE =
const AndroidWebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
const AndroidWebViewFeature_._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
///
static const WEB_MESSAGE_LISTENER =
const AndroidWebViewFeature._internal("WEB_MESSAGE_LISTENER");
const AndroidWebViewFeature_._internal("WEB_MESSAGE_LISTENER");
///
static const WEB_MESSAGE_PORT_CLOSE =
const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE");
const AndroidWebViewFeature_._internal("WEB_MESSAGE_PORT_CLOSE");
///
static const WEB_MESSAGE_PORT_POST_MESSAGE =
const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
const AndroidWebViewFeature_._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
///
static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK");
///
static const WEB_RESOURCE_ERROR_GET_CODE =
const AndroidWebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE");
const AndroidWebViewFeature_._internal("WEB_RESOURCE_ERROR_GET_CODE");
///
static const WEB_RESOURCE_ERROR_GET_DESCRIPTION =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"WEB_RESOURCE_ERROR_GET_DESCRIPTION");
///
static const WEB_RESOURCE_REQUEST_IS_REDIRECT =
const AndroidWebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
const AndroidWebViewFeature_._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
///
static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE =
const AndroidWebViewFeature._internal(
const AndroidWebViewFeature_._internal(
"WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE");
///
static const WEB_VIEW_RENDERER_TERMINATE =
const AndroidWebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const AndroidWebViewFeature_._internal("WEB_VIEW_RENDERER_TERMINATE");
///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher,
///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device,
///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isFeatureSupported(AndroidWebViewFeature feature) async {
static Future<bool> isFeatureSupported(AndroidWebViewFeature_ feature) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args);

View File

@ -0,0 +1,580 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'webview_feature.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device.
class WebViewFeature {
final String _value;
final String _nativeValue;
const WebViewFeature._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebViewFeature._internalMultiPlatform(
String value, Function nativeValue) =>
WebViewFeature._internal(value, nativeValue());
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///This feature covers [InAppWebViewController.createWebMessageChannel].
static const CREATE_WEB_MESSAGE_CHANNEL = WebViewFeature._internal(
'CREATE_WEB_MESSAGE_CHANNEL', 'CREATE_WEB_MESSAGE_CHANNEL');
///This feature covers [InAppWebViewSettings.disabledActionModeMenuItems].
static const DISABLED_ACTION_MODE_MENU_ITEMS = WebViewFeature._internal(
'DISABLED_ACTION_MODE_MENU_ITEMS', 'DISABLED_ACTION_MODE_MENU_ITEMS');
///This feature covers [InAppWebViewSettings.forceDark].
static const FORCE_DARK =
WebViewFeature._internal('FORCE_DARK', 'FORCE_DARK');
///This feature covers [InAppWebViewSettings.forceDarkStrategy].
static const FORCE_DARK_STRATEGY =
WebViewFeature._internal('FORCE_DARK_STRATEGY', 'FORCE_DARK_STRATEGY');
///
static const GET_WEB_CHROME_CLIENT = WebViewFeature._internal(
'GET_WEB_CHROME_CLIENT', 'GET_WEB_CHROME_CLIENT');
///
static const GET_WEB_VIEW_CLIENT =
WebViewFeature._internal('GET_WEB_VIEW_CLIENT', 'GET_WEB_VIEW_CLIENT');
///
static const GET_WEB_VIEW_RENDERER = WebViewFeature._internal(
'GET_WEB_VIEW_RENDERER', 'GET_WEB_VIEW_RENDERER');
///
static const MULTI_PROCESS =
WebViewFeature._internal('MULTI_PROCESS', 'MULTI_PROCESS');
///This feature covers [InAppWebViewSettings.offscreenPreRaster].
static const OFF_SCREEN_PRERASTER =
WebViewFeature._internal('OFF_SCREEN_PRERASTER', 'OFF_SCREEN_PRERASTER');
///This feature covers [InAppWebViewController.postWebMessage].
static const POST_WEB_MESSAGE =
WebViewFeature._internal('POST_WEB_MESSAGE', 'POST_WEB_MESSAGE');
///This feature covers [ProxyController.setProxyOverride] and [ProxyController.clearProxyOverride].
static const PROXY_OVERRIDE =
WebViewFeature._internal('PROXY_OVERRIDE', 'PROXY_OVERRIDE');
///
static const RECEIVE_HTTP_ERROR =
WebViewFeature._internal('RECEIVE_HTTP_ERROR', 'RECEIVE_HTTP_ERROR');
///
static const RECEIVE_WEB_RESOURCE_ERROR = WebViewFeature._internal(
'RECEIVE_WEB_RESOURCE_ERROR', 'RECEIVE_WEB_RESOURCE_ERROR');
///This feature covers [InAppWebViewController.setSafeBrowsingAllowlist].
static const SAFE_BROWSING_ALLOWLIST = WebViewFeature._internal(
'SAFE_BROWSING_ALLOWLIST', 'SAFE_BROWSING_ALLOWLIST');
///This feature covers [InAppWebViewSettings.safeBrowsingEnabled].
static const SAFE_BROWSING_ENABLE =
WebViewFeature._internal('SAFE_BROWSING_ENABLE', 'SAFE_BROWSING_ENABLE');
///
static const SAFE_BROWSING_HIT =
WebViewFeature._internal('SAFE_BROWSING_HIT', 'SAFE_BROWSING_HIT');
///This feature covers [InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl].
static const SAFE_BROWSING_PRIVACY_POLICY_URL = WebViewFeature._internal(
'SAFE_BROWSING_PRIVACY_POLICY_URL', 'SAFE_BROWSING_PRIVACY_POLICY_URL');
///
static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY = WebViewFeature._internal(
'SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY',
'SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY');
///
static const SAFE_BROWSING_RESPONSE_PROCEED = WebViewFeature._internal(
'SAFE_BROWSING_RESPONSE_PROCEED', 'SAFE_BROWSING_RESPONSE_PROCEED');
///
static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
WebViewFeature._internal('SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL',
'SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL');
///Use [SAFE_BROWSING_ALLOWLIST] instead.
static const SAFE_BROWSING_WHITELIST = WebViewFeature._internal(
'SAFE_BROWSING_WHITELIST', 'SAFE_BROWSING_WHITELIST');
///This feature covers [ServiceWorkerController].
static const SERVICE_WORKER_BASIC_USAGE = WebViewFeature._internal(
'SERVICE_WORKER_BASIC_USAGE', 'SERVICE_WORKER_BASIC_USAGE');
///This feature covers [ServiceWorkerController.setBlockNetworkLoads] and [ServiceWorkerController.getBlockNetworkLoads].
static const SERVICE_WORKER_BLOCK_NETWORK_LOADS = WebViewFeature._internal(
'SERVICE_WORKER_BLOCK_NETWORK_LOADS',
'SERVICE_WORKER_BLOCK_NETWORK_LOADS');
///This feature covers [ServiceWorkerController.setCacheMode] and [ServiceWorkerController.getCacheMode].
static const SERVICE_WORKER_CACHE_MODE = WebViewFeature._internal(
'SERVICE_WORKER_CACHE_MODE', 'SERVICE_WORKER_CACHE_MODE');
///This feature covers [ServiceWorkerController.setAllowContentAccess] and [ServiceWorkerController.getAllowContentAccess].
static const SERVICE_WORKER_CONTENT_ACCESS = WebViewFeature._internal(
'SERVICE_WORKER_CONTENT_ACCESS', 'SERVICE_WORKER_CONTENT_ACCESS');
///This feature covers [ServiceWorkerController.setAllowFileAccess] and [ServiceWorkerController.getAllowFileAccess].
static const SERVICE_WORKER_FILE_ACCESS = WebViewFeature._internal(
'SERVICE_WORKER_FILE_ACCESS', 'SERVICE_WORKER_FILE_ACCESS');
///This feature covers [ServiceWorkerClient.shouldInterceptRequest].
static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST =
WebViewFeature._internal('SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST',
'SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST');
///
static const SHOULD_OVERRIDE_WITH_REDIRECTS = WebViewFeature._internal(
'SHOULD_OVERRIDE_WITH_REDIRECTS', 'SHOULD_OVERRIDE_WITH_REDIRECTS');
///This feature covers [InAppWebViewController.startSafeBrowsing].
static const START_SAFE_BROWSING =
WebViewFeature._internal('START_SAFE_BROWSING', 'START_SAFE_BROWSING');
///
static const TRACING_CONTROLLER_BASIC_USAGE = WebViewFeature._internal(
'TRACING_CONTROLLER_BASIC_USAGE', 'TRACING_CONTROLLER_BASIC_USAGE');
///
static const VISUAL_STATE_CALLBACK = WebViewFeature._internal(
'VISUAL_STATE_CALLBACK', 'VISUAL_STATE_CALLBACK');
///
static const WEB_MESSAGE_CALLBACK_ON_MESSAGE = WebViewFeature._internal(
'WEB_MESSAGE_CALLBACK_ON_MESSAGE', 'WEB_MESSAGE_CALLBACK_ON_MESSAGE');
///This feature covers [WebMessageListener].
static const WEB_MESSAGE_LISTENER =
WebViewFeature._internal('WEB_MESSAGE_LISTENER', 'WEB_MESSAGE_LISTENER');
///
static const WEB_MESSAGE_PORT_CLOSE = WebViewFeature._internal(
'WEB_MESSAGE_PORT_CLOSE', 'WEB_MESSAGE_PORT_CLOSE');
///
static const WEB_MESSAGE_PORT_POST_MESSAGE = WebViewFeature._internal(
'WEB_MESSAGE_PORT_POST_MESSAGE', 'WEB_MESSAGE_PORT_POST_MESSAGE');
///
static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK = WebViewFeature._internal(
'WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK',
'WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK');
///
static const WEB_RESOURCE_ERROR_GET_CODE = WebViewFeature._internal(
'WEB_RESOURCE_ERROR_GET_CODE', 'WEB_RESOURCE_ERROR_GET_CODE');
///
static const WEB_RESOURCE_ERROR_GET_DESCRIPTION = WebViewFeature._internal(
'WEB_RESOURCE_ERROR_GET_DESCRIPTION',
'WEB_RESOURCE_ERROR_GET_DESCRIPTION');
///
static const WEB_RESOURCE_REQUEST_IS_REDIRECT = WebViewFeature._internal(
'WEB_RESOURCE_REQUEST_IS_REDIRECT', 'WEB_RESOURCE_REQUEST_IS_REDIRECT');
///
static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = WebViewFeature._internal(
'WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE',
'WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE');
///
static const WEB_VIEW_RENDERER_TERMINATE = WebViewFeature._internal(
'WEB_VIEW_RENDERER_TERMINATE', 'WEB_VIEW_RENDERER_TERMINATE');
///Set of all values of [WebViewFeature].
static final Set<WebViewFeature> values = [
WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
WebViewFeature.FORCE_DARK,
WebViewFeature.FORCE_DARK_STRATEGY,
WebViewFeature.GET_WEB_CHROME_CLIENT,
WebViewFeature.GET_WEB_VIEW_CLIENT,
WebViewFeature.GET_WEB_VIEW_RENDERER,
WebViewFeature.MULTI_PROCESS,
WebViewFeature.OFF_SCREEN_PRERASTER,
WebViewFeature.POST_WEB_MESSAGE,
WebViewFeature.PROXY_OVERRIDE,
WebViewFeature.RECEIVE_HTTP_ERROR,
WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
WebViewFeature.SAFE_BROWSING_ALLOWLIST,
WebViewFeature.SAFE_BROWSING_ENABLE,
WebViewFeature.SAFE_BROWSING_HIT,
WebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL,
WebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY,
WebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED,
WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL,
WebViewFeature.SAFE_BROWSING_WHITELIST,
WebViewFeature.SERVICE_WORKER_BASIC_USAGE,
WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS,
WebViewFeature.SERVICE_WORKER_CACHE_MODE,
WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS,
WebViewFeature.SERVICE_WORKER_FILE_ACCESS,
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
WebViewFeature.START_SAFE_BROWSING,
WebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
WebViewFeature.VISUAL_STATE_CALLBACK,
WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
WebViewFeature.WEB_MESSAGE_LISTENER,
WebViewFeature.WEB_MESSAGE_PORT_CLOSE,
WebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE,
WebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK,
WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE,
WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION,
WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
WebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
].toSet();
///Gets a possible [WebViewFeature] instance from [String] value.
static WebViewFeature? fromValue(String? value) {
if (value != null) {
try {
return WebViewFeature.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebViewFeature] instance from a native value.
static WebViewFeature? fromNativeValue(String? value) {
if (value != null) {
try {
return WebViewFeature.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher,
///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device,
///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isFeatureSupported(WebViewFeature_ feature) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args);
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}
///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device.
///Use [WebViewFeature] instead.
@Deprecated('Use WebViewFeature instead')
class AndroidWebViewFeature {
final String _value;
final String _nativeValue;
const AndroidWebViewFeature._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidWebViewFeature._internalMultiPlatform(
String value, Function nativeValue) =>
AndroidWebViewFeature._internal(value, nativeValue());
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///
static const CREATE_WEB_MESSAGE_CHANNEL = AndroidWebViewFeature._internal(
'CREATE_WEB_MESSAGE_CHANNEL', 'CREATE_WEB_MESSAGE_CHANNEL');
///
static const DISABLED_ACTION_MODE_MENU_ITEMS =
AndroidWebViewFeature._internal(
'DISABLED_ACTION_MODE_MENU_ITEMS', 'DISABLED_ACTION_MODE_MENU_ITEMS');
///
static const FORCE_DARK =
AndroidWebViewFeature._internal('FORCE_DARK', 'FORCE_DARK');
///
static const FORCE_DARK_STRATEGY = AndroidWebViewFeature._internal(
'FORCE_DARK_STRATEGY', 'FORCE_DARK_STRATEGY');
///
static const GET_WEB_CHROME_CLIENT = AndroidWebViewFeature._internal(
'GET_WEB_CHROME_CLIENT', 'GET_WEB_CHROME_CLIENT');
///
static const GET_WEB_VIEW_CLIENT = AndroidWebViewFeature._internal(
'GET_WEB_VIEW_CLIENT', 'GET_WEB_VIEW_CLIENT');
///
static const GET_WEB_VIEW_RENDERER = AndroidWebViewFeature._internal(
'GET_WEB_VIEW_RENDERER', 'GET_WEB_VIEW_RENDERER');
///
static const MULTI_PROCESS =
AndroidWebViewFeature._internal('MULTI_PROCESS', 'MULTI_PROCESS');
///
static const OFF_SCREEN_PRERASTER = AndroidWebViewFeature._internal(
'OFF_SCREEN_PRERASTER', 'OFF_SCREEN_PRERASTER');
///
static const POST_WEB_MESSAGE =
AndroidWebViewFeature._internal('POST_WEB_MESSAGE', 'POST_WEB_MESSAGE');
///
static const PROXY_OVERRIDE =
AndroidWebViewFeature._internal('PROXY_OVERRIDE', 'PROXY_OVERRIDE');
///
static const RECEIVE_HTTP_ERROR = AndroidWebViewFeature._internal(
'RECEIVE_HTTP_ERROR', 'RECEIVE_HTTP_ERROR');
///
static const RECEIVE_WEB_RESOURCE_ERROR = AndroidWebViewFeature._internal(
'RECEIVE_WEB_RESOURCE_ERROR', 'RECEIVE_WEB_RESOURCE_ERROR');
///
static const SAFE_BROWSING_ALLOWLIST = AndroidWebViewFeature._internal(
'SAFE_BROWSING_ALLOWLIST', 'SAFE_BROWSING_ALLOWLIST');
///
static const SAFE_BROWSING_ENABLE = AndroidWebViewFeature._internal(
'SAFE_BROWSING_ENABLE', 'SAFE_BROWSING_ENABLE');
///
static const SAFE_BROWSING_HIT =
AndroidWebViewFeature._internal('SAFE_BROWSING_HIT', 'SAFE_BROWSING_HIT');
///
static const SAFE_BROWSING_PRIVACY_POLICY_URL =
AndroidWebViewFeature._internal('SAFE_BROWSING_PRIVACY_POLICY_URL',
'SAFE_BROWSING_PRIVACY_POLICY_URL');
///
static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY =
AndroidWebViewFeature._internal('SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY',
'SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY');
///
static const SAFE_BROWSING_RESPONSE_PROCEED = AndroidWebViewFeature._internal(
'SAFE_BROWSING_RESPONSE_PROCEED', 'SAFE_BROWSING_RESPONSE_PROCEED');
///
static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
AndroidWebViewFeature._internal(
'SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL',
'SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL');
///Use [SAFE_BROWSING_ALLOWLIST] instead.
static const SAFE_BROWSING_WHITELIST = AndroidWebViewFeature._internal(
'SAFE_BROWSING_WHITELIST', 'SAFE_BROWSING_WHITELIST');
///
static const SERVICE_WORKER_BASIC_USAGE = AndroidWebViewFeature._internal(
'SERVICE_WORKER_BASIC_USAGE', 'SERVICE_WORKER_BASIC_USAGE');
///
static const SERVICE_WORKER_BLOCK_NETWORK_LOADS =
AndroidWebViewFeature._internal('SERVICE_WORKER_BLOCK_NETWORK_LOADS',
'SERVICE_WORKER_BLOCK_NETWORK_LOADS');
///
static const SERVICE_WORKER_CACHE_MODE = AndroidWebViewFeature._internal(
'SERVICE_WORKER_CACHE_MODE', 'SERVICE_WORKER_CACHE_MODE');
///
static const SERVICE_WORKER_CONTENT_ACCESS = AndroidWebViewFeature._internal(
'SERVICE_WORKER_CONTENT_ACCESS', 'SERVICE_WORKER_CONTENT_ACCESS');
///
static const SERVICE_WORKER_FILE_ACCESS = AndroidWebViewFeature._internal(
'SERVICE_WORKER_FILE_ACCESS', 'SERVICE_WORKER_FILE_ACCESS');
///
static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST =
AndroidWebViewFeature._internal('SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST',
'SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST');
///
static const SHOULD_OVERRIDE_WITH_REDIRECTS = AndroidWebViewFeature._internal(
'SHOULD_OVERRIDE_WITH_REDIRECTS', 'SHOULD_OVERRIDE_WITH_REDIRECTS');
///
static const START_SAFE_BROWSING = AndroidWebViewFeature._internal(
'START_SAFE_BROWSING', 'START_SAFE_BROWSING');
///
static const TRACING_CONTROLLER_BASIC_USAGE = AndroidWebViewFeature._internal(
'TRACING_CONTROLLER_BASIC_USAGE', 'TRACING_CONTROLLER_BASIC_USAGE');
///
static const VISUAL_STATE_CALLBACK = AndroidWebViewFeature._internal(
'VISUAL_STATE_CALLBACK', 'VISUAL_STATE_CALLBACK');
///
static const WEB_MESSAGE_CALLBACK_ON_MESSAGE =
AndroidWebViewFeature._internal(
'WEB_MESSAGE_CALLBACK_ON_MESSAGE', 'WEB_MESSAGE_CALLBACK_ON_MESSAGE');
///
static const WEB_MESSAGE_LISTENER = AndroidWebViewFeature._internal(
'WEB_MESSAGE_LISTENER', 'WEB_MESSAGE_LISTENER');
///
static const WEB_MESSAGE_PORT_CLOSE = AndroidWebViewFeature._internal(
'WEB_MESSAGE_PORT_CLOSE', 'WEB_MESSAGE_PORT_CLOSE');
///
static const WEB_MESSAGE_PORT_POST_MESSAGE = AndroidWebViewFeature._internal(
'WEB_MESSAGE_PORT_POST_MESSAGE', 'WEB_MESSAGE_PORT_POST_MESSAGE');
///
static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK =
AndroidWebViewFeature._internal('WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK',
'WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK');
///
static const WEB_RESOURCE_ERROR_GET_CODE = AndroidWebViewFeature._internal(
'WEB_RESOURCE_ERROR_GET_CODE', 'WEB_RESOURCE_ERROR_GET_CODE');
///
static const WEB_RESOURCE_ERROR_GET_DESCRIPTION =
AndroidWebViewFeature._internal('WEB_RESOURCE_ERROR_GET_DESCRIPTION',
'WEB_RESOURCE_ERROR_GET_DESCRIPTION');
///
static const WEB_RESOURCE_REQUEST_IS_REDIRECT =
AndroidWebViewFeature._internal('WEB_RESOURCE_REQUEST_IS_REDIRECT',
'WEB_RESOURCE_REQUEST_IS_REDIRECT');
///
static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE =
AndroidWebViewFeature._internal('WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE',
'WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE');
///
static const WEB_VIEW_RENDERER_TERMINATE = AndroidWebViewFeature._internal(
'WEB_VIEW_RENDERER_TERMINATE', 'WEB_VIEW_RENDERER_TERMINATE');
///Set of all values of [AndroidWebViewFeature].
static final Set<AndroidWebViewFeature> values = [
AndroidWebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
AndroidWebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
AndroidWebViewFeature.FORCE_DARK,
AndroidWebViewFeature.FORCE_DARK_STRATEGY,
AndroidWebViewFeature.GET_WEB_CHROME_CLIENT,
AndroidWebViewFeature.GET_WEB_VIEW_CLIENT,
AndroidWebViewFeature.GET_WEB_VIEW_RENDERER,
AndroidWebViewFeature.MULTI_PROCESS,
AndroidWebViewFeature.OFF_SCREEN_PRERASTER,
AndroidWebViewFeature.POST_WEB_MESSAGE,
AndroidWebViewFeature.PROXY_OVERRIDE,
AndroidWebViewFeature.RECEIVE_HTTP_ERROR,
AndroidWebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
AndroidWebViewFeature.SAFE_BROWSING_ALLOWLIST,
AndroidWebViewFeature.SAFE_BROWSING_ENABLE,
AndroidWebViewFeature.SAFE_BROWSING_HIT,
AndroidWebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED,
AndroidWebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL,
AndroidWebViewFeature.SAFE_BROWSING_WHITELIST,
AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE,
AndroidWebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS,
AndroidWebViewFeature.SERVICE_WORKER_CACHE_MODE,
AndroidWebViewFeature.SERVICE_WORKER_CONTENT_ACCESS,
AndroidWebViewFeature.SERVICE_WORKER_FILE_ACCESS,
AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
AndroidWebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
AndroidWebViewFeature.START_SAFE_BROWSING,
AndroidWebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
AndroidWebViewFeature.VISUAL_STATE_CALLBACK,
AndroidWebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
AndroidWebViewFeature.WEB_MESSAGE_LISTENER,
AndroidWebViewFeature.WEB_MESSAGE_PORT_CLOSE,
AndroidWebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE,
AndroidWebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK,
AndroidWebViewFeature.WEB_RESOURCE_ERROR_GET_CODE,
AndroidWebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION,
AndroidWebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
AndroidWebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
AndroidWebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
].toSet();
///Gets a possible [AndroidWebViewFeature] instance from [String] value.
static AndroidWebViewFeature? fromValue(String? value) {
if (value != null) {
try {
return AndroidWebViewFeature.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidWebViewFeature] instance from a native value.
static AndroidWebViewFeature? fromNativeValue(String? value) {
if (value != null) {
try {
return AndroidWebViewFeature.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher,
///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device,
///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isFeatureSupported(AndroidWebViewFeature_ feature) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args);
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -196,8 +196,8 @@ class IOSInAppWebViewOptions
///- [IOSInAppWebViewOptions.enableViewportScale]
///
///Events affected:
///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty
///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty
///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty
///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty
///- [WebView.onLoadResource]
///- [WebView.shouldInterceptAjaxRequest]
///- [WebView.onAjaxReadyStateChange]
@ -214,7 +214,7 @@ class IOSInAppWebViewOptions
///Used in combination with [WebView.initialUrlRequest] or [WebView.initialData] (using the `file://` scheme), it represents the URL from which to read the web content.
///This URL must be a file-based URL (using the `file://` scheme).
///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or
///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or
///the [InAppWebViewInitialData.baseUrl] if you are using it with the [WebView.initialData] parameter to prevent WebView from reading any other content.
///Specify a directory to give WebView permission to read additional files in the specified directory.
Uri? allowingReadAccessTo;

View File

@ -445,19 +445,19 @@ class InAppWebViewController {
if (_webview != null) {
if (_webview!.onRenderProcessUnresponsive != null)
return (await _webview!.onRenderProcessUnresponsive!(this, uri))
?.toMap();
?.toNativeValue();
else {
// ignore: deprecated_member_use_from_same_package
return (await _webview!.androidOnRenderProcessUnresponsive!(
this, uri))
?.toMap();
?.toNativeValue();
}
} else {
return ((await _inAppBrowser!.onRenderProcessUnresponsive(uri)) ??
(await _inAppBrowser!
// ignore: deprecated_member_use_from_same_package
.androidOnRenderProcessUnresponsive(uri)))
?.toMap();
?.toNativeValue();
}
}
break;
@ -473,19 +473,19 @@ class InAppWebViewController {
if (_webview != null) {
if (_webview!.onRenderProcessResponsive != null)
return (await _webview!.onRenderProcessResponsive!(this, uri))
?.toMap();
?.toNativeValue();
else {
// ignore: deprecated_member_use_from_same_package
return (await _webview!.androidOnRenderProcessResponsive!(
this, uri))
?.toMap();
?.toNativeValue();
}
} else {
return ((await _inAppBrowser!.onRenderProcessResponsive(uri)) ??
(await _inAppBrowser!
// ignore: deprecated_member_use_from_same_package
.androidOnRenderProcessResponsive(uri)))
?.toMap();
?.toNativeValue();
}
}
break;
@ -957,19 +957,19 @@ class InAppWebViewController {
if (_webview!.shouldAllowDeprecatedTLS != null)
return (await _webview!.shouldAllowDeprecatedTLS!(
this, challenge))
?.toMap();
?.toNativeValue();
else {
// ignore: deprecated_member_use_from_same_package
return (await _webview!.iosShouldAllowDeprecatedTLS!(
this, challenge))
?.toMap();
?.toNativeValue();
}
} else {
return (await _inAppBrowser!.shouldAllowDeprecatedTLS(challenge))
?.toMap() ??
?.toNativeValue() ??
// ignore: deprecated_member_use_from_same_package
(await _inAppBrowser!.iosShouldAllowDeprecatedTLS(challenge))
?.toMap();
?.toNativeValue();
}
}
break;
@ -2281,7 +2281,7 @@ class InAppWebViewController {
///Prints the current page.
///
///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+.
///
@ -2823,9 +2823,9 @@ class InAppWebViewController {
///[autoname] if `false`, takes [filePath] to be a file.
///If `true`, [filePath] is assumed to be a directory in which a filename will be chosen according to the URL of the current page.
///
///**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 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**:
///- 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)))
@ -2834,9 +2834,9 @@ class InAppWebViewController {
{required String filePath, bool autoname = false}) async {
if (!autoname) {
if (defaultTargetPlatform == TargetPlatform.android) {
assert(filePath.endsWith("." + WebArchiveFormat.MHT.toValue()));
assert(filePath.endsWith("." + WebArchiveFormat.MHT.toNativeValue()));
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
assert(filePath.endsWith("." + WebArchiveFormat.WEBARCHIVE.toValue()));
assert(filePath.endsWith("." + WebArchiveFormat.WEBARCHIVE.toNativeValue()));
}
}

View File

@ -916,8 +916,8 @@ class InAppWebViewSettings {
///- [InAppWebViewSettings.enableViewportScale]
///
///Events affected:
///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty
///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty
///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty
///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty
///- [WebView.onLoadResource]
///- [WebView.shouldInterceptAjaxRequest]
///- [WebView.onAjaxReadyStateChange]
@ -937,7 +937,7 @@ class InAppWebViewSettings {
///Used in combination with [WebView.initialUrlRequest] or [WebView.initialData] (using the `file://` scheme), it represents the URL from which to read the web content.
///This URL must be a file-based URL (using the `file://` scheme).
///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or
///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or
///the [InAppWebViewInitialData.baseUrl] if you are using it with the [WebView.initialData] parameter to prevent WebView from reading any other content.
///Specify a directory to give WebView permission to read additional files in the specified directory.
///
@ -1108,7 +1108,7 @@ class InAppWebViewSettings {
this.useHybridComposition = true,
this.useShouldInterceptRequest = false,
this.useOnRenderProcessGone = false,
this.overScrollMode = OverScrollMode.OVER_SCROLL_IF_CONTENT_SCROLLS,
this.overScrollMode = OverScrollMode.IF_CONTENT_SCROLLS,
this.networkAvailable,
this.scrollBarStyle = ScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY,
this.verticalScrollbarPosition =

View File

@ -6,7 +6,7 @@ import 'print_job_controller.dart';
///Class that represents the settings of a [PrintJobController].
class PrintJobSettings {
///Set this to `true` to handle the [PrintJobController].
///Set this to `true` to handle the [PrintJobController].
///Otherwise, it will be handled and disposed automatically by the system.
///The default value is `false`.
///

View File

@ -4,7 +4,7 @@ final _contentWorldNameRegExp = RegExp(r'[\s]');
///
///**NOTE for iOS**: available on iOS 14.0+. This class represents the native [WKContentWorld](https://developer.apple.com/documentation/webkit/wkcontentworld) class.
///
///**NOTE for Android**: it will create and append an `<iframe>` HTML element with `id` attribute equals to `flutter_inappwebview_[name]`
///**NOTE for Android**: it will create and append an `<iframe>` HTML element with `id` attribute equals to `flutter_inappwebview_[name]`
///to the webpage's content that contains only the inline `<script>` HTML elements in order to define a new scope of execution for JavaScript code.
///Unfortunately, there isn't any other way to do it.
///There are some limitations:

View File

@ -28,6 +28,9 @@ class LayoutInDisplayCutoutMode_ {
///
///**NOTE**: available on Android 30+.
static const ALWAYS = const LayoutInDisplayCutoutMode_._internal(3);
@ExchangeableObjectMethod(ignore: true)
static LayoutInDisplayCutoutMode_? fromNativeValue(int? value) {return null;}
}
///Android-specific class representing the share state that should be applied to the custom tab.
@ -62,4 +65,7 @@ class AndroidLayoutInDisplayCutoutMode_ {
///
///**NOTE**: available on Android 30+.
static const ALWAYS = const AndroidLayoutInDisplayCutoutMode_._internal(3);
@ExchangeableObjectMethod(ignore: true)
int toNativeValue() => 0;
}

View File

@ -26,8 +26,8 @@ class MetaTag {
final instance = MetaTag(
name: map['name'],
content: map['content'],
attrs: map['attrs']?.forEach(
(e) => MetaTagAttribute.fromMap(e?.cast<String, dynamic>())!),
attrs: map['attrs']
?.map((e) => MetaTagAttribute.fromMap(e?.cast<String, dynamic>())!),
);
return instance;
}

View File

@ -31,8 +31,8 @@ class PermissionRequest {
origin: Uri.parse(map['origin']),
frame: FrameInfo.fromMap(map['frame']?.cast<String, dynamic>()),
);
instance.resources = map['resources']
.forEach((e) => PermissionResourceType.fromNativeValue(e)!);
instance.resources =
map['resources'].map((e) => PermissionResourceType.fromNativeValue(e)!);
return instance;
}

View File

@ -24,8 +24,8 @@ class PermissionResponse {
return null;
}
final instance = PermissionResponse();
instance.resources = map['resources']
.forEach((e) => PermissionResourceType.fromNativeValue(e)!);
instance.resources =
map['resources'].map((e) => PermissionResourceType.fromNativeValue(e)!);
instance.action = PermissionResponseAction.fromNativeValue(map['action']);
return instance;
}

View File

@ -1,59 +1,37 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'should_allow_deprecated_tls_action.g.dart';
///Class that is used by [WebView.shouldAllowDeprecatedTLS] event.
///It represents the policy to pass back to the decision handler.
class ShouldAllowDeprecatedTLSAction {
@ExchangeableEnum()
class ShouldAllowDeprecatedTLSAction_ {
// ignore: unused_field
final int _value;
const ShouldAllowDeprecatedTLSAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const ShouldAllowDeprecatedTLSAction_._internal(this._value);
///Cancel the navigation.
static const CANCEL = const ShouldAllowDeprecatedTLSAction._internal(0);
static const CANCEL = const ShouldAllowDeprecatedTLSAction_._internal(0);
///Allow the navigation to continue.
static const ALLOW = const ShouldAllowDeprecatedTLSAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
Map<String, dynamic> toMap() {
return {
"action": _value,
};
}
static const ALLOW = const ShouldAllowDeprecatedTLSAction_._internal(1);
}
///Class that is used by [WebView.shouldAllowDeprecatedTLS] event.
///It represents the policy to pass back to the decision handler.
///Use [ShouldAllowDeprecatedTLSAction] instead.
@Deprecated("Use ShouldAllowDeprecatedTLSAction instead")
class IOSShouldAllowDeprecatedTLSAction {
@ExchangeableEnum()
class IOSShouldAllowDeprecatedTLSAction_ {
// ignore: unused_field
final int _value;
const IOSShouldAllowDeprecatedTLSAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const IOSShouldAllowDeprecatedTLSAction_._internal(this._value);
///Cancel the navigation.
static const CANCEL = const IOSShouldAllowDeprecatedTLSAction._internal(0);
static const CANCEL = const IOSShouldAllowDeprecatedTLSAction_._internal(0);
///Allow the navigation to continue.
static const ALLOW = const IOSShouldAllowDeprecatedTLSAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
Map<String, dynamic> toMap() {
return {
"action": _value,
};
}
static const ALLOW = const IOSShouldAllowDeprecatedTLSAction_._internal(1);
}

View File

@ -0,0 +1,157 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'should_allow_deprecated_tls_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that is used by [WebView.shouldAllowDeprecatedTLS] event.
///It represents the policy to pass back to the decision handler.
class ShouldAllowDeprecatedTLSAction {
final int _value;
final int _nativeValue;
const ShouldAllowDeprecatedTLSAction._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory ShouldAllowDeprecatedTLSAction._internalMultiPlatform(
int value, Function nativeValue) =>
ShouldAllowDeprecatedTLSAction._internal(value, nativeValue());
///Cancel the navigation.
static const CANCEL = ShouldAllowDeprecatedTLSAction._internal(0, 0);
///Allow the navigation to continue.
static const ALLOW = ShouldAllowDeprecatedTLSAction._internal(1, 1);
///Set of all values of [ShouldAllowDeprecatedTLSAction].
static final Set<ShouldAllowDeprecatedTLSAction> values = [
ShouldAllowDeprecatedTLSAction.CANCEL,
ShouldAllowDeprecatedTLSAction.ALLOW,
].toSet();
///Gets a possible [ShouldAllowDeprecatedTLSAction] instance from [int] value.
static ShouldAllowDeprecatedTLSAction? fromValue(int? value) {
if (value != null) {
try {
return ShouldAllowDeprecatedTLSAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ShouldAllowDeprecatedTLSAction] instance from a native value.
static ShouldAllowDeprecatedTLSAction? fromNativeValue(int? value) {
if (value != null) {
try {
return ShouldAllowDeprecatedTLSAction.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'ALLOW';
}
return _value.toString();
}
}
///Class that is used by [WebView.shouldAllowDeprecatedTLS] event.
///It represents the policy to pass back to the decision handler.
///Use [ShouldAllowDeprecatedTLSAction] instead.
@Deprecated('Use ShouldAllowDeprecatedTLSAction instead')
class IOSShouldAllowDeprecatedTLSAction {
final int _value;
final int _nativeValue;
const IOSShouldAllowDeprecatedTLSAction._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory IOSShouldAllowDeprecatedTLSAction._internalMultiPlatform(
int value, Function nativeValue) =>
IOSShouldAllowDeprecatedTLSAction._internal(value, nativeValue());
///Cancel the navigation.
static const CANCEL = IOSShouldAllowDeprecatedTLSAction._internal(0, 0);
///Allow the navigation to continue.
static const ALLOW = IOSShouldAllowDeprecatedTLSAction._internal(1, 1);
///Set of all values of [IOSShouldAllowDeprecatedTLSAction].
static final Set<IOSShouldAllowDeprecatedTLSAction> values = [
IOSShouldAllowDeprecatedTLSAction.CANCEL,
IOSShouldAllowDeprecatedTLSAction.ALLOW,
].toSet();
///Gets a possible [IOSShouldAllowDeprecatedTLSAction] instance from [int] value.
static IOSShouldAllowDeprecatedTLSAction? fromValue(int? value) {
if (value != null) {
try {
return IOSShouldAllowDeprecatedTLSAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSShouldAllowDeprecatedTLSAction] instance from a native value.
static IOSShouldAllowDeprecatedTLSAction? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSShouldAllowDeprecatedTLSAction.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'ALLOW';
}
return _value.toString();
}
}

View File

@ -1,68 +1,30 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ssl_error_type.dart';
part 'ssl_error.g.dart';
///Class that represents an SSL Error.
class SslError {
@ExchangeableObject()
class SslError_ {
///Use [code] instead.
@Deprecated('Use code instead')
AndroidSslError? androidError;
AndroidSslError_? androidError;
///Use [code] instead.
@Deprecated('Use code instead')
IOSSslError? iosError;
IOSSslError_? iosError;
///Primary code error associated to the server SSL certificate.
///It represents the most severe SSL error.
SslErrorType? code;
SslErrorType_? code;
///The message associated to the [code].
String? message;
SslError(
SslError_(
{@Deprecated('Use code instead') this.androidError,
@Deprecated('Use code instead') this.iosError,
this.code,
this.message}) {
this.code = this.code ??
// ignore: deprecated_member_use_from_same_package
SslErrorType.fromNativeValue(this.androidError?.toValue() ??
// ignore: deprecated_member_use_from_same_package
this.iosError?.toValue());
}
///Gets a possible [SslError] instance from a [Map] value.
static SslError? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return SslError(
// ignore: deprecated_member_use_from_same_package
androidError: AndroidSslError.fromValue(map["code"]),
// ignore: deprecated_member_use_from_same_package
iosError: IOSSslError.fromValue(map["code"]),
code: SslErrorType.fromNativeValue(map["code"]),
message: map["message"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
// ignore: deprecated_member_use_from_same_package
"androidError": code?.toNativeValue() ?? androidError?.toValue(),
// ignore: deprecated_member_use_from_same_package
"iosError": code?.toNativeValue() ?? iosError?.toValue(),
// ignore: deprecated_member_use_from_same_package
"code": code?.toNativeValue() ?? androidError?.toValue() ?? iosError?.toValue(),
"message": message,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.message}) {}
}

View File

@ -0,0 +1,65 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ssl_error.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents an SSL Error.
class SslError {
///Use [code] instead.
@Deprecated('Use code instead')
AndroidSslError? androidError;
///Use [code] instead.
@Deprecated('Use code instead')
IOSSslError? iosError;
///Primary code error associated to the server SSL certificate.
///It represents the most severe SSL error.
SslErrorType? code;
///The message associated to the [code].
String? message;
SslError(
{@Deprecated('Use code instead') this.androidError,
@Deprecated('Use code instead') this.iosError,
this.code,
this.message}) {
code = code ?? SslErrorType.fromNativeValue(androidError?.toNativeValue());
code = code ?? SslErrorType.fromNativeValue(iosError?.toNativeValue());
}
///Gets a possible [SslError] instance from a [Map] value.
static SslError? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = SslError(
androidError: AndroidSslError.fromNativeValue(map['code']),
iosError: IOSSslError.fromNativeValue(map['code']),
code: SslErrorType.fromNativeValue(map['code']),
message: map['message'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"code": code?.toNativeValue(),
"message": message,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'SslError{code: $code, message: $message}';
}
}

View File

@ -1,113 +1,85 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'package:flutter/foundation.dart';
import 'server_trust_challenge.dart';
part 'ssl_error_type.g.dart';
///Class that represents the SSL Primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
class SslErrorType {
@ExchangeableEnum()
class SslErrorType_ {
// ignore: unused_field
final String _value;
final int _nativeValue;
const SslErrorType._internal(this._value, this._nativeValue);
///Set of all values of [SslErrorType].
static final Set<SslErrorType> values = [
SslErrorType.NOT_YET_VALID,
SslErrorType.EXPIRED,
SslErrorType.IDMISMATCH,
SslErrorType.UNTRUSTED,
SslErrorType.DATE_INVALID,
SslErrorType.INVALID,
SslErrorType.DENY,
SslErrorType.UNSPECIFIED,
SslErrorType.RECOVERABLE_TRUST_FAILURE,
SslErrorType.FATAL_TRUST_FAILURE,
SslErrorType.OTHER_ERROR,
].toSet();
///Gets a possible [SslErrorType] instance from a [String] value.
static SslErrorType? fromValue(String? value) {
if (value != null) {
try {
return SslErrorType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [SslErrorType] instance from a native value.
static SslErrorType? fromNativeValue(int? value) {
if (value != null) {
try {
return SslErrorType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets native [int] value.
int toNativeValue() => _nativeValue;
@override
String toString() => _value;
// ignore: unused_field
final int _nativeValue = -1;
const SslErrorType_._internal(this._value);
///The certificate is not yet valid.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_NOTYETVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_NOTYETVALID))
static final NOT_YET_VALID = SslErrorType._internal('NOT_YET_VALID',
(defaultTargetPlatform == TargetPlatform.android) ? 0 : -1);
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.SSL_NOTYETVALID',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_NOTYETVALID',
value: 0
)
])
static const NOT_YET_VALID = SslErrorType_._internal('NOT_YET_VALID');
///The certificate has expired.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_EXPIRED](https://developer.android.com/reference/android/net/http/SslError#SSL_EXPIRED))
static final EXPIRED = SslErrorType._internal(
'EXPIRED', (defaultTargetPlatform == TargetPlatform.android) ? 1 : -1);
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.SSL_EXPIRED',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_EXPIRED',
value: 1
)
])
static const EXPIRED = SslErrorType_._internal('EXPIRED');
///Hostname mismatch.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_IDMISMATCH](https://developer.android.com/reference/android/net/http/SslError#SSL_IDMISMATCH))
static final IDMISMATCH = SslErrorType._internal(
'IDMISMATCH', (defaultTargetPlatform == TargetPlatform.android) ? 2 : -1);
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.SSL_IDMISMATCH',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_IDMISMATCH',
value: 2
)
])
static const IDMISMATCH = SslErrorType_._internal('IDMISMATCH');
///The certificate authority is not trusted.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_UNTRUSTED](https://developer.android.com/reference/android/net/http/SslError#SSL_UNTRUSTED))
static final UNTRUSTED = SslErrorType._internal(
'UNTRUSTED', (defaultTargetPlatform == TargetPlatform.android) ? 3 : -1);
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.SSL_UNTRUSTED',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_UNTRUSTED',
value: 3
)
])
static const UNTRUSTED = SslErrorType_._internal('UNTRUSTED');
///The date of the certificate is invalid.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_DATE_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID))
static final DATE_INVALID = SslErrorType._internal('DATE_INVALID',
(defaultTargetPlatform == TargetPlatform.android) ? 4 : -1);
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.DATE_INVALID',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID',
value: 4
)
])
static const DATE_INVALID = SslErrorType_._internal('DATE_INVALID');
///Indicates an invalid setting or result. A generic error occurred.
///
///**Supported Platforms/Implementations**:
///- 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))
static final INVALID = SslErrorType._internal(
'INVALID',
(defaultTargetPlatform == TargetPlatform.android)
? 5
: ((defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 0
: -1));
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: 'SslError.SSL_INVALID',
apiUrl: 'https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID',
value: 5
),
EnumIOSPlatform(
apiName: 'SecTrustResultType.invalid',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/invalid',
value: 0
)
])
static const INVALID = SslErrorType_._internal('INVALID');
///The user specified that the certificate should not be trusted.
///
@ -115,15 +87,14 @@ class SslErrorType {
///usually by clicking the appropriate button in a certificate trust panel.
///Your app should not trust the chain.
///The Keychain Access utility refers to this value as "Never Trust."
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny))
static final DENY = SslErrorType._internal(
'DENY',
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 3
: -1);
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'SecTrustResultType.deny',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/deny',
value: 3
)
])
static const DENY = SslErrorType_._internal('DENY');
///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
///
@ -133,15 +104,14 @@ class SslErrorType {
///The Keychain Access utility refers to this value as the Use System Policy, which is the default user setting.
///
///When receiving this value, most apps should trust the chain.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified))
static final UNSPECIFIED = SslErrorType._internal(
'UNSPECIFIED',
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 4
: -1);
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'SecTrustResultType.unspecified',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/unspecified',
value: 4
)
])
static const UNSPECIFIED = SslErrorType_._internal('UNSPECIFIED');
///Trust is denied, but recovery may be possible.
///
@ -152,15 +122,14 @@ class SslErrorType {
///The way you handle this depends on the situation.
///For example, if you are performing signature validation and you know when the message was originally received,
///you should check again using that date to see if the message was valid when you originally received it.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure))
static final RECOVERABLE_TRUST_FAILURE = SslErrorType._internal(
'RECOVERABLE_TRUST_FAILURE',
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 5
: -1);
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'SecTrustResultType.recoverableTrustFailure',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure',
value: 5
)
])
static const RECOVERABLE_TRUST_FAILURE = SslErrorType_._internal('RECOVERABLE_TRUST_FAILURE');
///Trust is denied and no simple fix is available.
///
@ -168,188 +137,84 @@ class SslErrorType {
///This usually represents a fundamental defect in the certificate data, such as an invalid encoding for a critical subjectAltName extension,
///an unsupported critical extension, or some other critical portion of the certificate that couldnt be interpreted.
///Changing parameter values and reevaluating is unlikely to succeed unless you provide different certificates.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure))
static final FATAL_TRUST_FAILURE = SslErrorType._internal(
'FATAL_TRUST_FAILURE',
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 6
: -1);
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'SecTrustResultType.fatalTrustFailure',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure',
value: 6
)
])
static const FATAL_TRUST_FAILURE = SslErrorType_._internal('FATAL_TRUST_FAILURE');
///Indicates a failure other than that of trust evaluation.
///
///This value indicates that evaluation failed for some other reason.
///This can be caused by either a revoked certificate or by OS-level errors that are unrelated to the certificates themselves.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror))
static final OTHER_ERROR = SslErrorType._internal(
'OTHER_ERROR',
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)
? 7
: -1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'SecTrustResultType.otherError',
apiUrl: 'https://developer.apple.com/documentation/security/sectrustresulttype/othererror',
value: 7
)
])
static const OTHER_ERROR = SslErrorType_._internal('OTHER_ERROR');
}
///Class that represents the Android-specific primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
///Use [SslErrorType] instead.
@Deprecated("Use SslErrorType instead")
class AndroidSslError {
@ExchangeableEnum()
class AndroidSslError_ {
// ignore: unused_field
final int _value;
const AndroidSslError._internal(this._value);
///Set of all values of [AndroidSslError].
static final Set<AndroidSslError> values = [
AndroidSslError.SSL_NOTYETVALID,
AndroidSslError.SSL_EXPIRED,
AndroidSslError.SSL_IDMISMATCH,
AndroidSslError.SSL_UNTRUSTED,
AndroidSslError.SSL_DATE_INVALID,
AndroidSslError.SSL_INVALID,
].toSet();
///Gets a possible [AndroidSslError] instance from an [int] value.
static AndroidSslError? fromValue(int? value) {
if (value != null) {
try {
return AndroidSslError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "SSL_EXPIRED";
case 2:
return "SSL_IDMISMATCH";
case 3:
return "SSL_UNTRUSTED";
case 4:
return "SSL_DATE_INVALID";
case 5:
return "SSL_INVALID";
case 0:
default:
return "SSL_NOTYETVALID";
}
}
const AndroidSslError_._internal(this._value);
///The certificate is not yet valid
static const SSL_NOTYETVALID = const AndroidSslError._internal(0);
static const SSL_NOTYETVALID = const AndroidSslError_._internal(0);
///The certificate has expired
static const SSL_EXPIRED = const AndroidSslError._internal(1);
static const SSL_EXPIRED = const AndroidSslError_._internal(1);
///Hostname mismatch
static const SSL_IDMISMATCH = const AndroidSslError._internal(2);
static const SSL_IDMISMATCH = const AndroidSslError_._internal(2);
///The certificate authority is not trusted
static const SSL_UNTRUSTED = const AndroidSslError._internal(3);
static const SSL_UNTRUSTED = const AndroidSslError_._internal(3);
///The date of the certificate is invalid
static const SSL_DATE_INVALID = const AndroidSslError._internal(4);
static const SSL_DATE_INVALID = const AndroidSslError_._internal(4);
///A generic error occurred
static const SSL_INVALID = const AndroidSslError._internal(5);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const SSL_INVALID = const AndroidSslError_._internal(5);
}
///Class that represents the iOS-specific primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
///Use [SslErrorType] instead.
@Deprecated("Use SslErrorType instead")
class IOSSslError {
@ExchangeableEnum()
class IOSSslError_ {
// ignore: unused_field
final int _value;
const IOSSslError._internal(this._value);
///Set of all values of [IOSSslError].
static final Set<IOSSslError> values = [
IOSSslError.INVALID,
IOSSslError.DENY,
IOSSslError.UNSPECIFIED,
IOSSslError.RECOVERABLE_TRUST_FAILURE,
IOSSslError.FATAL_TRUST_FAILURE,
IOSSslError.OTHER_ERROR,
].toSet();
///Gets a possible [IOSSslError] instance from an [int] value.
static IOSSslError? fromValue(int? value) {
if (value != null) {
try {
return IOSSslError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 3:
return "DENY";
case 4:
return "UNSPECIFIED";
case 5:
return "RECOVERABLE_TRUST_FAILURE";
case 6:
return "FATAL_TRUST_FAILURE";
case 7:
return "OTHER_ERROR";
case 0:
default:
return "INVALID";
}
}
const IOSSslError_._internal(this._value);
///Indicates an invalid setting or result.
static const INVALID = const IOSSslError._internal(0);
static const INVALID = const IOSSslError_._internal(0);
///Indicates a user-configured deny; do not proceed.
static const DENY = const IOSSslError._internal(3);
static const DENY = const IOSSslError_._internal(3);
///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
static const UNSPECIFIED = const IOSSslError._internal(4);
static const UNSPECIFIED = const IOSSslError_._internal(4);
///Indicates a trust policy failure which can be overridden by the user.
static const RECOVERABLE_TRUST_FAILURE = const IOSSslError._internal(5);
static const RECOVERABLE_TRUST_FAILURE = const IOSSslError_._internal(5);
///Indicates a trust failure which cannot be overridden by the user.
static const FATAL_TRUST_FAILURE = const IOSSslError._internal(6);
static const FATAL_TRUST_FAILURE = const IOSSslError_._internal(6);
///Indicates a failure other than that of trust evaluation.
static const OTHER_ERROR = const IOSSslError._internal(7);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const OTHER_ERROR = const IOSSslError_._internal(7);
}

View File

@ -0,0 +1,466 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ssl_error_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the SSL Primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
class SslErrorType {
final String _value;
final int _nativeValue;
const SslErrorType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory SslErrorType._internalMultiPlatform(
String value, Function nativeValue) =>
SslErrorType._internal(value, nativeValue());
///The certificate is not yet valid.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_NOTYETVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_NOTYETVALID))
static final NOT_YET_VALID =
SslErrorType._internalMultiPlatform('NOT_YET_VALID', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 0;
default:
break;
}
return null;
});
///The certificate has expired.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_EXPIRED](https://developer.android.com/reference/android/net/http/SslError#SSL_EXPIRED))
static final EXPIRED = SslErrorType._internalMultiPlatform('EXPIRED', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
default:
break;
}
return null;
});
///Hostname mismatch.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_IDMISMATCH](https://developer.android.com/reference/android/net/http/SslError#SSL_IDMISMATCH))
static final IDMISMATCH =
SslErrorType._internalMultiPlatform('IDMISMATCH', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 2;
default:
break;
}
return null;
});
///The certificate authority is not trusted.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_UNTRUSTED](https://developer.android.com/reference/android/net/http/SslError#SSL_UNTRUSTED))
static final UNTRUSTED = SslErrorType._internalMultiPlatform('UNTRUSTED', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 3;
default:
break;
}
return null;
});
///The date of the certificate is invalid.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.DATE_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID))
static final DATE_INVALID =
SslErrorType._internalMultiPlatform('DATE_INVALID', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 4;
default:
break;
}
return null;
});
///Indicates an invalid setting or result. A generic error occurred.
///
///**Supported Platforms/Implementations**:
///- 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))
static final INVALID = SslErrorType._internalMultiPlatform('INVALID', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 5;
case TargetPlatform.iOS:
return 0;
default:
break;
}
return null;
});
///The user specified that the certificate should not be trusted.
///
///This value indicates that the user explicitly chose to not trust a certificate in the chain,
///usually by clicking the appropriate button in a certificate trust panel.
///Your app should not trust the chain.
///The Keychain Access utility refers to this value as "Never Trust."
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny))
static final DENY = SslErrorType._internalMultiPlatform('DENY', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 3;
default:
break;
}
return null;
});
///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
///
///This value indicates that evaluation reached an (implicitly trusted) anchor certificate without any evaluation failures,
///but never encountered any explicitly stated user-trust preference.
///This is the most common return value.
///The Keychain Access utility refers to this value as the Use System Policy, which is the default user setting.
///
///When receiving this value, most apps should trust the chain.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified))
static final UNSPECIFIED =
SslErrorType._internalMultiPlatform('UNSPECIFIED', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 4;
default:
break;
}
return null;
});
///Trust is denied, but recovery may be possible.
///
///This value indicates that you should not trust the chain as is,
///but that the chain could be trusted with some minor change to the evaluation context,
///such as ignoring expired certificates or adding another anchor to the set of trusted anchors.
///
///The way you handle this depends on the situation.
///For example, if you are performing signature validation and you know when the message was originally received,
///you should check again using that date to see if the message was valid when you originally received it.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure))
static final RECOVERABLE_TRUST_FAILURE =
SslErrorType._internalMultiPlatform('RECOVERABLE_TRUST_FAILURE', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 5;
default:
break;
}
return null;
});
///Trust is denied and no simple fix is available.
///
///This value indicates that evaluation failed because a certificate in the chain is defective.
///This usually represents a fundamental defect in the certificate data, such as an invalid encoding for a critical subjectAltName extension,
///an unsupported critical extension, or some other critical portion of the certificate that couldnt be interpreted.
///Changing parameter values and reevaluating is unlikely to succeed unless you provide different certificates.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure))
static final FATAL_TRUST_FAILURE =
SslErrorType._internalMultiPlatform('FATAL_TRUST_FAILURE', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 6;
default:
break;
}
return null;
});
///Indicates a failure other than that of trust evaluation.
///
///This value indicates that evaluation failed for some other reason.
///This can be caused by either a revoked certificate or by OS-level errors that are unrelated to the certificates themselves.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror))
static final OTHER_ERROR =
SslErrorType._internalMultiPlatform('OTHER_ERROR', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 7;
default:
break;
}
return null;
});
///Set of all values of [SslErrorType].
static final Set<SslErrorType> values = [
SslErrorType.NOT_YET_VALID,
SslErrorType.EXPIRED,
SslErrorType.IDMISMATCH,
SslErrorType.UNTRUSTED,
SslErrorType.DATE_INVALID,
SslErrorType.INVALID,
SslErrorType.DENY,
SslErrorType.UNSPECIFIED,
SslErrorType.RECOVERABLE_TRUST_FAILURE,
SslErrorType.FATAL_TRUST_FAILURE,
SslErrorType.OTHER_ERROR,
].toSet();
///Gets a possible [SslErrorType] instance from [String] value.
static SslErrorType? fromValue(String? value) {
if (value != null) {
try {
return SslErrorType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [SslErrorType] instance from a native value.
static SslErrorType? fromNativeValue(int? value) {
if (value != null) {
try {
return SslErrorType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}
///Class that represents the Android-specific primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
///Use [SslErrorType] instead.
@Deprecated('Use SslErrorType instead')
class AndroidSslError {
final int _value;
final int _nativeValue;
const AndroidSslError._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidSslError._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidSslError._internal(value, nativeValue());
///The certificate is not yet valid
static const SSL_NOTYETVALID = AndroidSslError._internal(0, 0);
///The certificate has expired
static const SSL_EXPIRED = AndroidSslError._internal(1, 1);
///Hostname mismatch
static const SSL_IDMISMATCH = AndroidSslError._internal(2, 2);
///The certificate authority is not trusted
static const SSL_UNTRUSTED = AndroidSslError._internal(3, 3);
///The date of the certificate is invalid
static const SSL_DATE_INVALID = AndroidSslError._internal(4, 4);
///A generic error occurred
static const SSL_INVALID = AndroidSslError._internal(5, 5);
///Set of all values of [AndroidSslError].
static final Set<AndroidSslError> values = [
AndroidSslError.SSL_NOTYETVALID,
AndroidSslError.SSL_EXPIRED,
AndroidSslError.SSL_IDMISMATCH,
AndroidSslError.SSL_UNTRUSTED,
AndroidSslError.SSL_DATE_INVALID,
AndroidSslError.SSL_INVALID,
].toSet();
///Gets a possible [AndroidSslError] instance from [int] value.
static AndroidSslError? fromValue(int? value) {
if (value != null) {
try {
return AndroidSslError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidSslError] instance from a native value.
static AndroidSslError? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidSslError.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'SSL_NOTYETVALID';
case 1:
return 'SSL_EXPIRED';
case 2:
return 'SSL_IDMISMATCH';
case 3:
return 'SSL_UNTRUSTED';
case 4:
return 'SSL_DATE_INVALID';
case 5:
return 'SSL_INVALID';
}
return _value.toString();
}
}
///Class that represents the iOS-specific primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
///Use [SslErrorType] instead.
@Deprecated('Use SslErrorType instead')
class IOSSslError {
final int _value;
final int _nativeValue;
const IOSSslError._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSSslError._internalMultiPlatform(int value, Function nativeValue) =>
IOSSslError._internal(value, nativeValue());
///Indicates an invalid setting or result.
static const INVALID = IOSSslError._internal(0, 0);
///Indicates a user-configured deny; do not proceed.
static const DENY = IOSSslError._internal(3, 3);
///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
static const UNSPECIFIED = IOSSslError._internal(4, 4);
///Indicates a trust policy failure which can be overridden by the user.
static const RECOVERABLE_TRUST_FAILURE = IOSSslError._internal(5, 5);
///Indicates a trust failure which cannot be overridden by the user.
static const FATAL_TRUST_FAILURE = IOSSslError._internal(6, 6);
///Indicates a failure other than that of trust evaluation.
static const OTHER_ERROR = IOSSslError._internal(7, 7);
///Set of all values of [IOSSslError].
static final Set<IOSSslError> values = [
IOSSslError.INVALID,
IOSSslError.DENY,
IOSSslError.UNSPECIFIED,
IOSSslError.RECOVERABLE_TRUST_FAILURE,
IOSSslError.FATAL_TRUST_FAILURE,
IOSSslError.OTHER_ERROR,
].toSet();
///Gets a possible [IOSSslError] instance from [int] value.
static IOSSslError? fromValue(int? value) {
if (value != null) {
try {
return IOSSslError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSSslError] instance from a native value.
static IOSSslError? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSSslError.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'INVALID';
case 3:
return 'DENY';
case 4:
return 'UNSPECIFIED';
case 5:
return 'RECOVERABLE_TRUST_FAILURE';
case 6:
return 'FATAL_TRUST_FAILURE';
case 7:
return 'OTHER_ERROR';
}
return _value.toString();
}
}

View File

@ -1,23 +1,23 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'trusted_web_activity_display_mode.dart';
part 'trusted_web_activity_default_display_mode.g.dart';
///Class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityDefaultDisplayMode
implements TrustedWebActivityDisplayMode {
String _type = "DEFAULT_MODE";
@ExchangeableObject(fromMapFactory: false)
class TrustedWebActivityDefaultDisplayMode_
implements TrustedWebActivityDisplayMode_ {
static final _type = "DEFAULT_MODE";
///Converts instance to a map.
Map<String, dynamic> toMap() {
@ExchangeableObjectMethod(toMapMergeWith: true)
// ignore: unused_element
Map<String, dynamic> _toMapMergeWith() {
return {"type": _type};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
@ExchangeableObjectMethod(ignore: true)
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

View File

@ -0,0 +1,36 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trusted_web_activity_default_display_mode.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityDefaultDisplayMode
implements TrustedWebActivityDisplayMode {
static final String _type = "DEFAULT_MODE";
TrustedWebActivityDefaultDisplayMode();
@ExchangeableObjectMethod(toMapMergeWith: true)
Map<String, dynamic> _toMapMergeWith() {
return {"type": _type};
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
..._toMapMergeWith(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'TrustedWebActivityDefaultDisplayMode{}';
}
}

View File

@ -1,17 +1,9 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'trusted_web_activity_display_mode.g.dart';
///Class that represents display mode of a Trusted Web Activity.
abstract class TrustedWebActivityDisplayMode {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {};
}
@ExchangeableObject(fromMapFactory: false)
abstract class TrustedWebActivityDisplayMode_ {
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trusted_web_activity_display_mode.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents display mode of a Trusted Web Activity.
abstract class TrustedWebActivityDisplayMode {
TrustedWebActivityDisplayMode();
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'TrustedWebActivityDisplayMode{}';
}
}

View File

@ -1,64 +1,45 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'trusted_web_activity_display_mode.dart';
import 'layout_in_display_cutout_mode.dart';
part 'trusted_web_activity_immersive_display_mode.g.dart';
///Class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityImmersiveDisplayMode
implements TrustedWebActivityDisplayMode {
@ExchangeableObject()
class TrustedWebActivityImmersiveDisplayMode_
implements TrustedWebActivityDisplayMode_ {
///Whether the Trusted Web Activity should be in sticky immersive mode.
bool isSticky;
///Use [displayCutoutMode] instead.
@Deprecated("Use displayCutoutMode instead")
AndroidLayoutInDisplayCutoutMode? layoutInDisplayCutoutMode;
AndroidLayoutInDisplayCutoutMode_? layoutInDisplayCutoutMode;
///The constant defining how to deal with display cutouts.
LayoutInDisplayCutoutMode displayCutoutMode;
LayoutInDisplayCutoutMode_ displayCutoutMode;
String _type = "IMMERSIVE_MODE";
static final _type = "IMMERSIVE_MODE";
TrustedWebActivityImmersiveDisplayMode(
@ExchangeableObjectConstructor()
TrustedWebActivityImmersiveDisplayMode_(
{required this.isSticky,
this.displayCutoutMode = LayoutInDisplayCutoutMode.DEFAULT,
this.displayCutoutMode = LayoutInDisplayCutoutMode_.DEFAULT,
this.layoutInDisplayCutoutMode}) {
// ignore: deprecated_member_use_from_same_package
this.displayCutoutMode = this.layoutInDisplayCutoutMode != null
? LayoutInDisplayCutoutMode.fromValue(
// ignore: deprecated_member_use_from_same_package
this.layoutInDisplayCutoutMode!.toValue())!
? LayoutInDisplayCutoutMode_.fromNativeValue(
layoutInDisplayCutoutMode?.toNativeValue())!
: this.displayCutoutMode;
}
///Gets a possible [TrustedWebActivityImmersiveDisplayMode] instance from a [Map] value.
static TrustedWebActivityImmersiveDisplayMode? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return TrustedWebActivityImmersiveDisplayMode(
isSticky: map["isSticky"],
displayCutoutMode: map["layoutInDisplayCutoutMode"],
layoutInDisplayCutoutMode: map["layoutInDisplayCutoutMode"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"isSticky": isSticky,
"layoutInDisplayCutoutMode": displayCutoutMode.toValue(),
"displayCutoutMode": displayCutoutMode.toValue(),
"type": _type
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
@ExchangeableObjectMethod(toMapMergeWith: true)
// ignore: unused_element
Map<String, dynamic> _toMapMergeWith() {
return {"type": _type};
}
@override
String toString() {
return toMap().toString();
}
@ExchangeableObjectMethod(ignore: true)
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

View File

@ -0,0 +1,73 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trusted_web_activity_immersive_display_mode.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityImmersiveDisplayMode
implements TrustedWebActivityDisplayMode {
///Whether the Trusted Web Activity should be in sticky immersive mode.
bool isSticky;
///Use [displayCutoutMode] instead.
@Deprecated('Use displayCutoutMode instead')
AndroidLayoutInDisplayCutoutMode? layoutInDisplayCutoutMode;
///The constant defining how to deal with display cutouts.
LayoutInDisplayCutoutMode displayCutoutMode;
static final String _type = "IMMERSIVE_MODE";
TrustedWebActivityImmersiveDisplayMode(
{required this.isSticky,
this.displayCutoutMode = LayoutInDisplayCutoutMode.DEFAULT,
this.layoutInDisplayCutoutMode}) {
this.displayCutoutMode = this.layoutInDisplayCutoutMode != null
? LayoutInDisplayCutoutMode.fromNativeValue(
layoutInDisplayCutoutMode?.toNativeValue())!
: this.displayCutoutMode;
}
///Gets a possible [TrustedWebActivityImmersiveDisplayMode] instance from a [Map] value.
static TrustedWebActivityImmersiveDisplayMode? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = TrustedWebActivityImmersiveDisplayMode(
isSticky: map['isSticky'],
layoutInDisplayCutoutMode:
AndroidLayoutInDisplayCutoutMode.fromNativeValue(
map['displayCutoutMode']),
);
instance.displayCutoutMode =
LayoutInDisplayCutoutMode.fromNativeValue(map['displayCutoutMode'])!;
return instance;
}
@ExchangeableObjectMethod(toMapMergeWith: true)
Map<String, dynamic> _toMapMergeWith() {
return {"type": _type};
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
..._toMapMergeWith(),
"isSticky": isSticky,
"displayCutoutMode": displayCutoutMode.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'TrustedWebActivityImmersiveDisplayMode{isSticky: $isSticky, displayCutoutMode: $displayCutoutMode}';
}
}

View File

@ -1,115 +1,61 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'trusted_web_activity_screen_orientation.g.dart';
///Class representing Screen Orientation Lock type value of a Trusted Web Activity:
///https://www.w3.org/TR/screen-orientation/#screenorientation-interface
class TrustedWebActivityScreenOrientation {
@ExchangeableEnum()
class TrustedWebActivityScreenOrientation_ {
// ignore: unused_field
final int _value;
const TrustedWebActivityScreenOrientation._internal(this._value);
///Set of all values of [TrustedWebActivityScreenOrientation].
static final Set<TrustedWebActivityScreenOrientation> values = [
TrustedWebActivityScreenOrientation.DEFAULT,
TrustedWebActivityScreenOrientation.PORTRAIT_PRIMARY,
TrustedWebActivityScreenOrientation.PORTRAIT_SECONDARY,
TrustedWebActivityScreenOrientation.LANDSCAPE_PRIMARY,
TrustedWebActivityScreenOrientation.LANDSCAPE_SECONDARY,
TrustedWebActivityScreenOrientation.ANY,
TrustedWebActivityScreenOrientation.LANDSCAPE,
TrustedWebActivityScreenOrientation.PORTRAIT,
TrustedWebActivityScreenOrientation.NATURAL,
].toSet();
///Gets a possible [TrustedWebActivityScreenOrientation] instance from an [int] value.
static TrustedWebActivityScreenOrientation? fromValue(int? value) {
if (value != null) {
try {
return TrustedWebActivityScreenOrientation.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "PORTRAIT_PRIMARY";
case 2:
return "PORTRAIT_SECONDARY";
case 3:
return "LANDSCAPE_PRIMARY";
case 4:
return "LANDSCAPE_SECONDARY";
case 5:
return "ANY";
case 6:
return "LANDSCAPE";
case 7:
return "PORTRAIT";
case 8:
return "NATURAL";
case 0:
default:
return "DEFAULT";
}
}
const TrustedWebActivityScreenOrientation_._internal(this._value);
/// The default screen orientation is the set of orientations to which the screen is locked when
/// there is no current orientation lock.
static const DEFAULT = const TrustedWebActivityScreenOrientation._internal(0);
static const DEFAULT = const TrustedWebActivityScreenOrientation_._internal(0);
/// Portrait-primary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-primary when held in that position.
static const PORTRAIT_PRIMARY =
const TrustedWebActivityScreenOrientation._internal(1);
const TrustedWebActivityScreenOrientation_._internal(1);
/// Portrait-secondary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-secondary when rotated 180° from its natural position.
static const PORTRAIT_SECONDARY =
const TrustedWebActivityScreenOrientation._internal(2);
const TrustedWebActivityScreenOrientation_._internal(2);
/// Landscape-primary is an orientation where the screen width is greater than the screen height.
/// If the device's natural orientation is landscape, then it is in landscape-primary when held
/// in that position.
static const LANDSCAPE_PRIMARY =
const TrustedWebActivityScreenOrientation._internal(3);
const TrustedWebActivityScreenOrientation_._internal(3);
/// Landscape-secondary is an orientation where the screen width is greater than the
/// screen height. If the device's natural orientation is landscape, it is in
/// landscape-secondary when rotated 180° from its natural orientation.
static const LANDSCAPE_SECONDARY =
const TrustedWebActivityScreenOrientation._internal(4);
const TrustedWebActivityScreenOrientation_._internal(4);
/// Any is an orientation that means the screen can be locked to any one of portrait-primary,
/// portrait-secondary, landscape-primary and landscape-secondary.
static const ANY = const TrustedWebActivityScreenOrientation._internal(5);
static const ANY = const TrustedWebActivityScreenOrientation_._internal(5);
/// Landscape is an orientation where the screen width is greater than the screen height and
/// depending on platform convention locking the screen to landscape can represent
/// landscape-primary, landscape-secondary or both.
static const LANDSCAPE =
const TrustedWebActivityScreenOrientation._internal(6);
const TrustedWebActivityScreenOrientation_._internal(6);
/// Portrait is an orientation where the screen width is less than or equal to the screen height
/// and depending on platform convention locking the screen to portrait can represent
/// portrait-primary, portrait-secondary or both.
static const PORTRAIT =
const TrustedWebActivityScreenOrientation._internal(7);
const TrustedWebActivityScreenOrientation_._internal(7);
/// Natural is an orientation that refers to either portrait-primary or landscape-primary
/// depending on the device's usual orientation. This orientation is usually provided by
/// the underlying operating system.
static const NATURAL = const TrustedWebActivityScreenOrientation._internal(8);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const NATURAL = const TrustedWebActivityScreenOrientation_._internal(8);
}

View File

@ -0,0 +1,143 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trusted_web_activity_screen_orientation.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class representing Screen Orientation Lock type value of a Trusted Web Activity:
///https://www.w3.org/TR/screen-orientation/#screenorientation-interface
class TrustedWebActivityScreenOrientation {
final int _value;
final int _nativeValue;
const TrustedWebActivityScreenOrientation._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory TrustedWebActivityScreenOrientation._internalMultiPlatform(
int value, Function nativeValue) =>
TrustedWebActivityScreenOrientation._internal(value, nativeValue());
/// The default screen orientation is the set of orientations to which the screen is locked when
/// there is no current orientation lock.
static const DEFAULT = TrustedWebActivityScreenOrientation._internal(0, 0);
/// Portrait-primary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-primary when held in that position.
static const PORTRAIT_PRIMARY =
TrustedWebActivityScreenOrientation._internal(1, 1);
/// Portrait-secondary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-secondary when rotated 180° from its natural position.
static const PORTRAIT_SECONDARY =
TrustedWebActivityScreenOrientation._internal(2, 2);
/// Landscape-primary is an orientation where the screen width is greater than the screen height.
/// If the device's natural orientation is landscape, then it is in landscape-primary when held
/// in that position.
static const LANDSCAPE_PRIMARY =
TrustedWebActivityScreenOrientation._internal(3, 3);
/// Landscape-secondary is an orientation where the screen width is greater than the
/// screen height. If the device's natural orientation is landscape, it is in
/// landscape-secondary when rotated 180° from its natural orientation.
static const LANDSCAPE_SECONDARY =
TrustedWebActivityScreenOrientation._internal(4, 4);
/// Any is an orientation that means the screen can be locked to any one of portrait-primary,
/// portrait-secondary, landscape-primary and landscape-secondary.
static const ANY = TrustedWebActivityScreenOrientation._internal(5, 5);
/// Landscape is an orientation where the screen width is greater than the screen height and
/// depending on platform convention locking the screen to landscape can represent
/// landscape-primary, landscape-secondary or both.
static const LANDSCAPE = TrustedWebActivityScreenOrientation._internal(6, 6);
/// Portrait is an orientation where the screen width is less than or equal to the screen height
/// and depending on platform convention locking the screen to portrait can represent
/// portrait-primary, portrait-secondary or both.
static const PORTRAIT = TrustedWebActivityScreenOrientation._internal(7, 7);
/// Natural is an orientation that refers to either portrait-primary or landscape-primary
/// depending on the device's usual orientation. This orientation is usually provided by
/// the underlying operating system.
static const NATURAL = TrustedWebActivityScreenOrientation._internal(8, 8);
///Set of all values of [TrustedWebActivityScreenOrientation].
static final Set<TrustedWebActivityScreenOrientation> values = [
TrustedWebActivityScreenOrientation.DEFAULT,
TrustedWebActivityScreenOrientation.PORTRAIT_PRIMARY,
TrustedWebActivityScreenOrientation.PORTRAIT_SECONDARY,
TrustedWebActivityScreenOrientation.LANDSCAPE_PRIMARY,
TrustedWebActivityScreenOrientation.LANDSCAPE_SECONDARY,
TrustedWebActivityScreenOrientation.ANY,
TrustedWebActivityScreenOrientation.LANDSCAPE,
TrustedWebActivityScreenOrientation.PORTRAIT,
TrustedWebActivityScreenOrientation.NATURAL,
].toSet();
///Gets a possible [TrustedWebActivityScreenOrientation] instance from [int] value.
static TrustedWebActivityScreenOrientation? fromValue(int? value) {
if (value != null) {
try {
return TrustedWebActivityScreenOrientation.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [TrustedWebActivityScreenOrientation] instance from a native value.
static TrustedWebActivityScreenOrientation? fromNativeValue(int? value) {
if (value != null) {
try {
return TrustedWebActivityScreenOrientation.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'DEFAULT';
case 1:
return 'PORTRAIT_PRIMARY';
case 2:
return 'PORTRAIT_SECONDARY';
case 3:
return 'LANDSCAPE_PRIMARY';
case 4:
return 'LANDSCAPE_SECONDARY';
case 5:
return 'ANY';
case 6:
return 'LANDSCAPE';
case 7:
return 'PORTRAIT';
case 8:
return 'NATURAL';
}
return _value.toString();
}
}

View File

@ -26,7 +26,7 @@ class URLProtectionSpace {
SslCertificate? sslCertificate;
///The SSL Error associated.
dynamic sslError;
SslError? sslError;
///Use [authenticationMethod] instead.
@Deprecated('Use authenticationMethod instead')
@ -63,7 +63,7 @@ class URLProtectionSpace {
///Use [proxyType] instead.
@Deprecated('Use proxyType instead')
dynamic iosProxyType;
IOSNSURLProtectionSpaceProxyType? iosProxyType;
///The receiver's proxy type.
///This value is `null` if the receiver does not represent a proxy protection space.
@ -71,7 +71,7 @@ class URLProtectionSpace {
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.proxyType](https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype))
dynamic proxyType;
URLProtectionSpaceProxyType? proxyType;
URLProtectionSpace(
{required this.host,
this.protocol,
@ -97,7 +97,9 @@ class URLProtectionSpace {
distinguishedNames = distinguishedNames ?? iosDistinguishedNames;
receivesCredentialSecurely =
receivesCredentialSecurely ?? iosReceivesCredentialSecurely;
proxyType = proxyType ?? iosProxyType;
proxyType = proxyType ??
URLProtectionSpaceProxyType.fromNativeValue(
iosProxyType?.toNativeValue());
}
///Gets a possible [URLProtectionSpace] instance from a [Map] value.
@ -112,7 +114,7 @@ class URLProtectionSpace {
port: map['port'],
sslCertificate: SslCertificate.fromMap(
map['sslCertificate']?.cast<String, dynamic>()),
sslError: map['sslError'],
sslError: SslError.fromMap(map['sslError']?.cast<String, dynamic>()),
iosAuthenticationMethod:
IOSNSURLProtectionSpaceAuthenticationMethod.fromNativeValue(
map['authenticationMethod']),
@ -125,8 +127,9 @@ class URLProtectionSpace {
_distinguishedNamesDeserializer(map['distinguishedNames']),
iosReceivesCredentialSecurely: map['receivesCredentialSecurely'],
receivesCredentialSecurely: map['receivesCredentialSecurely'],
iosProxyType: map['proxyType'],
proxyType: map['proxyType'],
iosProxyType:
IOSNSURLProtectionSpaceProxyType.fromNativeValue(map['proxyType']),
proxyType: URLProtectionSpaceProxyType.fromNativeValue(map['proxyType']),
);
return instance;
}
@ -139,11 +142,11 @@ class URLProtectionSpace {
"realm": realm,
"port": port,
"sslCertificate": sslCertificate?.toMap(),
"sslError": sslError,
"sslError": sslError?.toMap(),
"authenticationMethod": authenticationMethod?.toNativeValue(),
"distinguishedNames": distinguishedNames?.map((e) => e.toMap()).toList(),
"receivesCredentialSecurely": receivesCredentialSecurely,
"proxyType": proxyType,
"proxyType": proxyType?.toNativeValue(),
};
}

View File

@ -1,65 +1,21 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_protection_space.dart';
import 'url_credential.dart';
import '../http_auth_credentials_database.dart';
part 'url_protection_space_http_auth_credentials.g.dart';
///Class that represents a [URLProtectionSpace] with all of its [URLCredential]s.
///It used by [HttpAuthCredentialDatabase.getAllAuthCredentials].
class URLProtectionSpaceHttpAuthCredentials {
@ExchangeableObject()
class URLProtectionSpaceHttpAuthCredentials_ {
///The protection space.
URLProtectionSpace? protectionSpace;
URLProtectionSpace_? protectionSpace;
///The list of all its http authentication credentials.
List<URLCredential>? credentials;
List<URLCredential_>? credentials;
URLProtectionSpaceHttpAuthCredentials(
URLProtectionSpaceHttpAuthCredentials_(
{this.protectionSpace, this.credentials});
///Gets a possible [URLProtectionSpaceHttpAuthCredentials] instance from a [Map] value.
static URLProtectionSpaceHttpAuthCredentials? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
List<URLCredential>? credentials;
if (map["credentials"] != null) {
credentials = <URLCredential>[];
(map["credentials"].cast<Map<String, dynamic>>()
as List<Map<String, dynamic>>)
.forEach((element) {
var credential = URLCredential.fromMap(element);
if (credential != null) {
credentials!.add(credential);
}
});
}
return URLProtectionSpaceHttpAuthCredentials(
protectionSpace: map["protectionSpace"] != null
? URLProtectionSpace.fromMap(
map["protectionSpace"]?.cast<String, dynamic>())
: null,
credentials: credentials,
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace?.toMap(),
"credentials": credentials != null
? credentials!.map((credential) => credential.toMap()).toList()
: null
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,52 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_protection_space_http_auth_credentials.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a [URLProtectionSpace] with all of its [URLCredential]s.
///It used by [HttpAuthCredentialDatabase.getAllAuthCredentials].
class URLProtectionSpaceHttpAuthCredentials {
///The protection space.
URLProtectionSpace? protectionSpace;
///The list of all its http authentication credentials.
List<URLCredential>? credentials;
URLProtectionSpaceHttpAuthCredentials(
{this.protectionSpace, this.credentials});
///Gets a possible [URLProtectionSpaceHttpAuthCredentials] instance from a [Map] value.
static URLProtectionSpaceHttpAuthCredentials? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = URLProtectionSpaceHttpAuthCredentials(
protectionSpace: URLProtectionSpace.fromMap(
map['protectionSpace']?.cast<String, dynamic>()),
credentials: map['credentials']
?.map((e) => URLCredential.fromMap(e?.cast<String, dynamic>())!),
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace?.toMap(),
"credentials": credentials?.map((e) => e.toMap()).toList(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'URLProtectionSpaceHttpAuthCredentials{protectionSpace: $protectionSpace, credentials: $credentials}';
}
}

View File

@ -1,119 +1,61 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'url_protection_space_proxy_type.g.dart';
///Class that represents the supported proxy types.
class URLProtectionSpaceProxyType {
@ExchangeableEnum()
class URLProtectionSpaceProxyType_ {
// ignore: unused_field
final String _value;
const URLProtectionSpaceProxyType._internal(this._value);
///Set of all values of [URLProtectionSpaceProxyType].
static final Set<URLProtectionSpaceProxyType> values = [
URLProtectionSpaceProxyType.NSUR_PROTECTION_SPACE_HTTP_PROXY,
URLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_HTTPS_PROXY,
URLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_FTP_PROXY,
URLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_SOCKS_PROXY,
].toSet();
///Gets a possible [URLProtectionSpaceProxyType] instance from a [String] value.
static URLProtectionSpaceProxyType? fromValue(String? value) {
if (value != null) {
try {
return URLProtectionSpaceProxyType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const URLProtectionSpaceProxyType_._internal(this._value);
///The proxy type for HTTP proxies.
static const NSUR_PROTECTION_SPACE_HTTP_PROXY =
const URLProtectionSpaceProxyType._internal(
static const URL_PROTECTION_SPACE_HTTP_PROXY =
const URLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceHTTPProxy");
///The proxy type for HTTPS proxies.
static const NSURL_PROTECTION_SPACE_HTTPS_PROXY =
const URLProtectionSpaceProxyType._internal(
static const URL_PROTECTION_SPACE_HTTPS_PROXY =
const URLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceHTTPSProxy");
///The proxy type for FTP proxies.
static const NSURL_PROTECTION_SPACE_FTP_PROXY =
const URLProtectionSpaceProxyType._internal(
static const URL_PROTECTION_SPACE_FTP_PROXY =
const URLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceFTPProxy");
///The proxy type for SOCKS proxies.
static const NSURL_PROTECTION_SPACE_SOCKS_PROXY =
const URLProtectionSpaceProxyType._internal(
static const URL_PROTECTION_SPACE_SOCKS_PROXY =
const URLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceSOCKSProxy");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}
///An iOS-specific Class that represents the supported proxy types.
///Use [URLProtectionSpaceProxyType] instead.
@Deprecated("Use URLProtectionSpaceProxyType instead")
class IOSNSURLProtectionSpaceProxyType {
@ExchangeableEnum()
class IOSNSURLProtectionSpaceProxyType_ {
// ignore: unused_field
final String _value;
const IOSNSURLProtectionSpaceProxyType._internal(this._value);
///Set of all values of [IOSNSURLProtectionSpaceProxyType].
static final Set<IOSNSURLProtectionSpaceProxyType> values = [
IOSNSURLProtectionSpaceProxyType.NSUR_PROTECTION_SPACE_HTTP_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_HTTPS_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_FTP_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_SOCKS_PROXY,
].toSet();
///Gets a possible [IOSNSURLProtectionSpaceProxyType] instance from a [String] value.
static IOSNSURLProtectionSpaceProxyType? fromValue(String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceProxyType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const IOSNSURLProtectionSpaceProxyType_._internal(this._value);
///The proxy type for HTTP proxies.
static const NSUR_PROTECTION_SPACE_HTTP_PROXY =
const IOSNSURLProtectionSpaceProxyType._internal(
const IOSNSURLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceHTTPProxy");
///The proxy type for HTTPS proxies.
static const NSURL_PROTECTION_SPACE_HTTPS_PROXY =
const IOSNSURLProtectionSpaceProxyType._internal(
const IOSNSURLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceHTTPSProxy");
///The proxy type for FTP proxies.
static const NSURL_PROTECTION_SPACE_FTP_PROXY =
const IOSNSURLProtectionSpaceProxyType._internal(
const IOSNSURLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceFTPProxy");
///The proxy type for SOCKS proxies.
static const NSURL_PROTECTION_SPACE_SOCKS_PROXY =
const IOSNSURLProtectionSpaceProxyType._internal(
const IOSNSURLProtectionSpaceProxyType_._internal(
"NSURLProtectionSpaceSOCKSProxy");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}

View File

@ -0,0 +1,174 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_protection_space_proxy_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the supported proxy types.
class URLProtectionSpaceProxyType {
final String _value;
final String _nativeValue;
const URLProtectionSpaceProxyType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory URLProtectionSpaceProxyType._internalMultiPlatform(
String value, Function nativeValue) =>
URLProtectionSpaceProxyType._internal(value, nativeValue());
///The proxy type for HTTP proxies.
static const URL_PROTECTION_SPACE_HTTP_PROXY =
URLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceHTTPProxy', 'NSURLProtectionSpaceHTTPProxy');
///The proxy type for HTTPS proxies.
static const URL_PROTECTION_SPACE_HTTPS_PROXY =
URLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceHTTPSProxy', 'NSURLProtectionSpaceHTTPSProxy');
///The proxy type for FTP proxies.
static const URL_PROTECTION_SPACE_FTP_PROXY =
URLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceFTPProxy', 'NSURLProtectionSpaceFTPProxy');
///The proxy type for SOCKS proxies.
static const URL_PROTECTION_SPACE_SOCKS_PROXY =
URLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceSOCKSProxy', 'NSURLProtectionSpaceSOCKSProxy');
///Set of all values of [URLProtectionSpaceProxyType].
static final Set<URLProtectionSpaceProxyType> values = [
URLProtectionSpaceProxyType.URL_PROTECTION_SPACE_HTTP_PROXY,
URLProtectionSpaceProxyType.URL_PROTECTION_SPACE_HTTPS_PROXY,
URLProtectionSpaceProxyType.URL_PROTECTION_SPACE_FTP_PROXY,
URLProtectionSpaceProxyType.URL_PROTECTION_SPACE_SOCKS_PROXY,
].toSet();
///Gets a possible [URLProtectionSpaceProxyType] instance from [String] value.
static URLProtectionSpaceProxyType? fromValue(String? value) {
if (value != null) {
try {
return URLProtectionSpaceProxyType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [URLProtectionSpaceProxyType] instance from a native value.
static URLProtectionSpaceProxyType? fromNativeValue(String? value) {
if (value != null) {
try {
return URLProtectionSpaceProxyType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}
///An iOS-specific Class that represents the supported proxy types.
///Use [URLProtectionSpaceProxyType] instead.
@Deprecated('Use URLProtectionSpaceProxyType instead')
class IOSNSURLProtectionSpaceProxyType {
final String _value;
final String _nativeValue;
const IOSNSURLProtectionSpaceProxyType._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory IOSNSURLProtectionSpaceProxyType._internalMultiPlatform(
String value, Function nativeValue) =>
IOSNSURLProtectionSpaceProxyType._internal(value, nativeValue());
///The proxy type for HTTP proxies.
static const NSUR_PROTECTION_SPACE_HTTP_PROXY =
IOSNSURLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceHTTPProxy', 'NSURLProtectionSpaceHTTPProxy');
///The proxy type for HTTPS proxies.
static const NSURL_PROTECTION_SPACE_HTTPS_PROXY =
IOSNSURLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceHTTPSProxy', 'NSURLProtectionSpaceHTTPSProxy');
///The proxy type for FTP proxies.
static const NSURL_PROTECTION_SPACE_FTP_PROXY =
IOSNSURLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceFTPProxy', 'NSURLProtectionSpaceFTPProxy');
///The proxy type for SOCKS proxies.
static const NSURL_PROTECTION_SPACE_SOCKS_PROXY =
IOSNSURLProtectionSpaceProxyType._internal(
'NSURLProtectionSpaceSOCKSProxy', 'NSURLProtectionSpaceSOCKSProxy');
///Set of all values of [IOSNSURLProtectionSpaceProxyType].
static final Set<IOSNSURLProtectionSpaceProxyType> values = [
IOSNSURLProtectionSpaceProxyType.NSUR_PROTECTION_SPACE_HTTP_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_HTTPS_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_FTP_PROXY,
IOSNSURLProtectionSpaceProxyType.NSURL_PROTECTION_SPACE_SOCKS_PROXY,
].toSet();
///Gets a possible [IOSNSURLProtectionSpaceProxyType] instance from [String] value.
static IOSNSURLProtectionSpaceProxyType? fromValue(String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceProxyType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSNSURLProtectionSpaceProxyType] instance from a native value.
static IOSNSURLProtectionSpaceProxyType? fromNativeValue(String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceProxyType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -10,7 +10,7 @@ part 'url_request.g.dart';
///A URL load request that is independent of protocol or URL scheme.
@ExchangeableObject()
class URLRequest_ {
///The URL of the request. Setting this to `null` will load `about:blank`.
///The URL of the request. Setting this to `null` will load `about:blank`.
Uri? url;
///The HTTP request method.

View File

@ -8,7 +8,7 @@ part of 'url_request.dart';
///A URL load request that is independent of protocol or URL scheme.
class URLRequest {
///The URL of the request. Setting this to `null` will load `about:blank`.
///The URL of the request. Setting this to `null` will load `about:blank`.
Uri? url;
///The HTTP request method.

View File

@ -1,56 +1,20 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'user_preferred_content_mode.g.dart';
///Class that represents the content mode to prefer when loading and rendering a webpage.
class UserPreferredContentMode {
@ExchangeableEnum()
class UserPreferredContentMode_ {
// ignore: unused_field
final int _value;
const UserPreferredContentMode._internal(this._value);
///Set of all values of [UserPreferredContentMode].
static final Set<UserPreferredContentMode> values = [
UserPreferredContentMode.RECOMMENDED,
UserPreferredContentMode.MOBILE,
UserPreferredContentMode.DESKTOP,
].toSet();
///Gets a possible [UserPreferredContentMode] instance from an [int] value.
static UserPreferredContentMode? fromValue(int? value) {
if (value != null) {
try {
return UserPreferredContentMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "MOBILE";
case 2:
return "DESKTOP";
case 0:
default:
return "RECOMMENDED";
}
}
const UserPreferredContentMode_._internal(this._value);
///The recommended content mode for the current platform.
static const RECOMMENDED = const UserPreferredContentMode._internal(0);
static const RECOMMENDED = const UserPreferredContentMode_._internal(0);
///Represents content targeting mobile browsers.
static const MOBILE = const UserPreferredContentMode._internal(1);
static const MOBILE = const UserPreferredContentMode_._internal(1);
///Represents content targeting desktop browsers.
static const DESKTOP = const UserPreferredContentMode._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const DESKTOP = const UserPreferredContentMode_._internal(2);
}

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_preferred_content_mode.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the content mode to prefer when loading and rendering a webpage.
class UserPreferredContentMode {
final int _value;
final int _nativeValue;
const UserPreferredContentMode._internal(this._value, this._nativeValue);
// ignore: unused_element
factory UserPreferredContentMode._internalMultiPlatform(
int value, Function nativeValue) =>
UserPreferredContentMode._internal(value, nativeValue());
///The recommended content mode for the current platform.
static const RECOMMENDED = UserPreferredContentMode._internal(0, 0);
///Represents content targeting mobile browsers.
static const MOBILE = UserPreferredContentMode._internal(1, 1);
///Represents content targeting desktop browsers.
static const DESKTOP = UserPreferredContentMode._internal(2, 2);
///Set of all values of [UserPreferredContentMode].
static final Set<UserPreferredContentMode> values = [
UserPreferredContentMode.RECOMMENDED,
UserPreferredContentMode.MOBILE,
UserPreferredContentMode.DESKTOP,
].toSet();
///Gets a possible [UserPreferredContentMode] instance from [int] value.
static UserPreferredContentMode? fromValue(int? value) {
if (value != null) {
try {
return UserPreferredContentMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [UserPreferredContentMode] instance from a native value.
static UserPreferredContentMode? fromNativeValue(int? value) {
if (value != null) {
try {
return UserPreferredContentMode.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'RECOMMENDED';
case 1:
return 'MOBILE';
case 2:
return 'DESKTOP';
}
return _value.toString();
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'user_script_injection_time.dart';
import 'content_world.dart';
part 'user_script.g.dart';
///Class that represents a script that the [WebView] injects into the web page.
class UserScript {
@ExchangeableObject()
class UserScript_ {
///The scripts group name.
String? groupName;
@ -11,7 +16,7 @@ class UserScript {
String source;
///The time at which to inject the script into the [WebView].
UserScriptInjectionTime injectionTime;
UserScriptInjectionTime_ injectionTime;
///Use [forMainFrameOnly] instead.
@Deprecated("Use forMainFrameOnly instead")
@ -28,7 +33,8 @@ class UserScript {
///For more information about content worlds, see [ContentWorld].
late ContentWorld contentWorld;
UserScript(
@ExchangeableObjectConstructor()
UserScript_(
{this.groupName,
required this.source,
required this.injectionTime,
@ -42,26 +48,4 @@ class UserScript {
? this.iosForMainFrameOnly!
: this.forMainFrameOnly;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"groupName": groupName,
"source": source,
"injectionTime": injectionTime.toValue(),
"iosForMainFrameOnly": forMainFrameOnly,
"forMainFrameOnly": forMainFrameOnly,
"contentWorld": contentWorld.toMap()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,84 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_script.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a script that the [WebView] injects into the web page.
class UserScript {
///The scripts group name.
String? groupName;
///The scripts source code.
String source;
///The time at which to inject the script into the [WebView].
UserScriptInjectionTime injectionTime;
///Use [forMainFrameOnly] instead.
@Deprecated('Use forMainFrameOnly instead')
bool? iosForMainFrameOnly;
///A Boolean value that indicates whether to inject the script into the main frame.
///Specify true to inject the script only into the main frame, or false to inject it into all frames.
///The default value is `true`.
///
///**NOTE**: available only on iOS.
bool forMainFrameOnly;
///A scope of execution in which to evaluate the script to prevent conflicts between different scripts.
///For more information about content worlds, see [ContentWorld].
late ContentWorld contentWorld;
UserScript(
{this.groupName,
required this.source,
required this.injectionTime,
@Deprecated("Use forMainFrameOnly instead") this.iosForMainFrameOnly,
this.forMainFrameOnly = true,
ContentWorld? contentWorld}) {
this.contentWorld = contentWorld ?? ContentWorld.PAGE;
this.forMainFrameOnly = this.iosForMainFrameOnly != null
? this.iosForMainFrameOnly!
: this.forMainFrameOnly;
}
///Gets a possible [UserScript] instance from a [Map] value.
static UserScript? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = UserScript(
groupName: map['groupName'],
source: map['source'],
injectionTime:
UserScriptInjectionTime.fromNativeValue(map['injectionTime'])!,
iosForMainFrameOnly: map['forMainFrameOnly'],
);
instance.forMainFrameOnly = map['forMainFrameOnly'];
instance.contentWorld = map['contentWorld'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"groupName": groupName,
"source": source,
"injectionTime": injectionTime.toNativeValue(),
"forMainFrameOnly": forMainFrameOnly,
"contentWorld": contentWorld.toMap(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'UserScript{groupName: $groupName, source: $source, injectionTime: $injectionTime, forMainFrameOnly: $forMainFrameOnly, contentWorld: $contentWorld}';
}
}

View File

@ -1,57 +1,24 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'user_script.dart';
part 'user_script_injection_time.g.dart';
///Class that represents contains the constants for the times at which to inject script content into a [WebView] used by an [UserScript].
class UserScriptInjectionTime {
@ExchangeableEnum()
class UserScriptInjectionTime_ {
// ignore: unused_field
final int _value;
const UserScriptInjectionTime._internal(this._value);
///Set of all values of [UserScriptInjectionTime].
static final Set<UserScriptInjectionTime> values = [
UserScriptInjectionTime.AT_DOCUMENT_START,
UserScriptInjectionTime.AT_DOCUMENT_END,
].toSet();
///Gets a possible [UserScriptInjectionTime] instance from an [int] value.
static UserScriptInjectionTime? fromValue(int? value) {
if (value != null) {
try {
return UserScriptInjectionTime.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "AT_DOCUMENT_END";
case 0:
default:
return "AT_DOCUMENT_START";
}
}
const UserScriptInjectionTime_._internal(this._value);
///**NOTE for iOS**: A constant to inject the script after the creation of the webpages document element, but before loading any other content.
///
///**NOTE for Android**: A constant to try to inject the script as soon as the page starts loading.
static const AT_DOCUMENT_START = const UserScriptInjectionTime._internal(0);
static const AT_DOCUMENT_START = const UserScriptInjectionTime_._internal(0);
///**NOTE for iOS**: A constant to inject the script after the document finishes loading, but before loading any other subresources.
///
///**NOTE for Android**: A constant to inject the script as soon as the page finishes loading.
static const AT_DOCUMENT_END = const UserScriptInjectionTime._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const AT_DOCUMENT_END = const UserScriptInjectionTime_._internal(1);
}

View File

@ -0,0 +1,83 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_script_injection_time.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents contains the constants for the times at which to inject script content into a [WebView] used by an [UserScript].
class UserScriptInjectionTime {
final int _value;
final int _nativeValue;
const UserScriptInjectionTime._internal(this._value, this._nativeValue);
// ignore: unused_element
factory UserScriptInjectionTime._internalMultiPlatform(
int value, Function nativeValue) =>
UserScriptInjectionTime._internal(value, nativeValue());
///**NOTE for iOS**: A constant to inject the script after the creation of the webpages document element, but before loading any other content.
///
///**NOTE for Android**: A constant to try to inject the script as soon as the page starts loading.
static const AT_DOCUMENT_START = UserScriptInjectionTime._internal(0, 0);
///**NOTE for iOS**: A constant to inject the script after the document finishes loading, but before loading any other subresources.
///
///**NOTE for Android**: A constant to inject the script as soon as the page finishes loading.
static const AT_DOCUMENT_END = UserScriptInjectionTime._internal(1, 1);
///Set of all values of [UserScriptInjectionTime].
static final Set<UserScriptInjectionTime> values = [
UserScriptInjectionTime.AT_DOCUMENT_START,
UserScriptInjectionTime.AT_DOCUMENT_END,
].toSet();
///Gets a possible [UserScriptInjectionTime] instance from [int] value.
static UserScriptInjectionTime? fromValue(int? value) {
if (value != null) {
try {
return UserScriptInjectionTime.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [UserScriptInjectionTime] instance from a native value.
static UserScriptInjectionTime? fromNativeValue(int? value) {
if (value != null) {
try {
return UserScriptInjectionTime.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'AT_DOCUMENT_START';
case 1:
return 'AT_DOCUMENT_END';
}
return _value.toString();
}
}

View File

@ -1,121 +1,45 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'vertical_scrollbar_position.g.dart';
///Class used to configure the position of the vertical scroll bar.
class VerticalScrollbarPosition {
@ExchangeableEnum()
class VerticalScrollbarPosition_ {
// ignore: unused_field
final int _value;
const VerticalScrollbarPosition._internal(this._value);
///Set of all values of [VerticalScrollbarPosition].
static final Set<VerticalScrollbarPosition> values = [
VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
VerticalScrollbarPosition.SCROLLBAR_POSITION_LEFT,
VerticalScrollbarPosition.SCROLLBAR_POSITION_RIGHT,
].toSet();
///Gets a possible [VerticalScrollbarPosition] instance from an [int] value.
static VerticalScrollbarPosition? fromValue(int? value) {
if (value != null) {
try {
return VerticalScrollbarPosition.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "SCROLLBAR_POSITION_LEFT";
case 2:
return "SCROLLBAR_POSITION_RIGHT";
case 0:
default:
return "SCROLLBAR_POSITION_DEFAULT";
}
}
const VerticalScrollbarPosition_._internal(this._value);
///Position the scroll bar at the default position as determined by the system.
static const SCROLLBAR_POSITION_DEFAULT =
const VerticalScrollbarPosition._internal(0);
const VerticalScrollbarPosition_._internal(0);
///Position the scroll bar along the left edge.
static const SCROLLBAR_POSITION_LEFT =
const VerticalScrollbarPosition._internal(1);
const VerticalScrollbarPosition_._internal(1);
///Position the scroll bar along the right edge.
static const SCROLLBAR_POSITION_RIGHT =
const VerticalScrollbarPosition._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const VerticalScrollbarPosition_._internal(2);
}
///An Android-specific class used to configure the position of the vertical scroll bar.
///Use [VerticalScrollbarPosition] instead.
@Deprecated("Use VerticalScrollbarPosition instead")
class AndroidVerticalScrollbarPosition {
@ExchangeableEnum()
class AndroidVerticalScrollbarPosition_ {
// ignore: unused_field
final int _value;
const AndroidVerticalScrollbarPosition._internal(this._value);
///Set of all values of [AndroidVerticalScrollbarPosition].
static final Set<AndroidVerticalScrollbarPosition> values = [
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_LEFT,
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_RIGHT,
].toSet();
///Gets a possible [AndroidVerticalScrollbarPosition] instance from an [int] value.
static AndroidVerticalScrollbarPosition? fromValue(int? value) {
if (value != null) {
try {
return AndroidVerticalScrollbarPosition.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "SCROLLBAR_POSITION_LEFT";
case 2:
return "SCROLLBAR_POSITION_RIGHT";
case 0:
default:
return "SCROLLBAR_POSITION_DEFAULT";
}
}
const AndroidVerticalScrollbarPosition_._internal(this._value);
///Position the scroll bar at the default position as determined by the system.
static const SCROLLBAR_POSITION_DEFAULT =
const AndroidVerticalScrollbarPosition._internal(0);
const AndroidVerticalScrollbarPosition_._internal(0);
///Position the scroll bar along the left edge.
static const SCROLLBAR_POSITION_LEFT =
const AndroidVerticalScrollbarPosition._internal(1);
const AndroidVerticalScrollbarPosition_._internal(1);
///Position the scroll bar along the right edge.
static const SCROLLBAR_POSITION_RIGHT =
const AndroidVerticalScrollbarPosition._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const AndroidVerticalScrollbarPosition_._internal(2);
}

View File

@ -0,0 +1,172 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'vertical_scrollbar_position.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to configure the position of the vertical scroll bar.
class VerticalScrollbarPosition {
final int _value;
final int _nativeValue;
const VerticalScrollbarPosition._internal(this._value, this._nativeValue);
// ignore: unused_element
factory VerticalScrollbarPosition._internalMultiPlatform(
int value, Function nativeValue) =>
VerticalScrollbarPosition._internal(value, nativeValue());
///Position the scroll bar at the default position as determined by the system.
static const SCROLLBAR_POSITION_DEFAULT =
VerticalScrollbarPosition._internal(0, 0);
///Position the scroll bar along the left edge.
static const SCROLLBAR_POSITION_LEFT =
VerticalScrollbarPosition._internal(1, 1);
///Position the scroll bar along the right edge.
static const SCROLLBAR_POSITION_RIGHT =
VerticalScrollbarPosition._internal(2, 2);
///Set of all values of [VerticalScrollbarPosition].
static final Set<VerticalScrollbarPosition> values = [
VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
VerticalScrollbarPosition.SCROLLBAR_POSITION_LEFT,
VerticalScrollbarPosition.SCROLLBAR_POSITION_RIGHT,
].toSet();
///Gets a possible [VerticalScrollbarPosition] instance from [int] value.
static VerticalScrollbarPosition? fromValue(int? value) {
if (value != null) {
try {
return VerticalScrollbarPosition.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [VerticalScrollbarPosition] instance from a native value.
static VerticalScrollbarPosition? fromNativeValue(int? value) {
if (value != null) {
try {
return VerticalScrollbarPosition.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'SCROLLBAR_POSITION_DEFAULT';
case 1:
return 'SCROLLBAR_POSITION_LEFT';
case 2:
return 'SCROLLBAR_POSITION_RIGHT';
}
return _value.toString();
}
}
///An Android-specific class used to configure the position of the vertical scroll bar.
///Use [VerticalScrollbarPosition] instead.
@Deprecated('Use VerticalScrollbarPosition instead')
class AndroidVerticalScrollbarPosition {
final int _value;
final int _nativeValue;
const AndroidVerticalScrollbarPosition._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory AndroidVerticalScrollbarPosition._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidVerticalScrollbarPosition._internal(value, nativeValue());
///Position the scroll bar at the default position as determined by the system.
static const SCROLLBAR_POSITION_DEFAULT =
AndroidVerticalScrollbarPosition._internal(0, 0);
///Position the scroll bar along the left edge.
static const SCROLLBAR_POSITION_LEFT =
AndroidVerticalScrollbarPosition._internal(1, 1);
///Position the scroll bar along the right edge.
static const SCROLLBAR_POSITION_RIGHT =
AndroidVerticalScrollbarPosition._internal(2, 2);
///Set of all values of [AndroidVerticalScrollbarPosition].
static final Set<AndroidVerticalScrollbarPosition> values = [
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_LEFT,
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_RIGHT,
].toSet();
///Gets a possible [AndroidVerticalScrollbarPosition] instance from [int] value.
static AndroidVerticalScrollbarPosition? fromValue(int? value) {
if (value != null) {
try {
return AndroidVerticalScrollbarPosition.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidVerticalScrollbarPosition] instance from a native value.
static AndroidVerticalScrollbarPosition? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidVerticalScrollbarPosition.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'SCROLLBAR_POSITION_DEFAULT';
case 1:
return 'SCROLLBAR_POSITION_LEFT';
case 2:
return 'SCROLLBAR_POSITION_RIGHT';
}
return _value.toString();
}
}

View File

@ -1,40 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'web_archive_format.g.dart';
///Class that represents the known Web Archive formats used when saving a web page.
class WebArchiveFormat {
@ExchangeableEnum()
class WebArchiveFormat_ {
// ignore: unused_field
final String _value;
const WebArchiveFormat._internal(this._value);
///Set of all values of [WebArchiveFormat].
static final Set<WebArchiveFormat> values =
[WebArchiveFormat.MHT, WebArchiveFormat.WEBARCHIVE].toSet();
///Gets a possible [WebArchiveFormat] instance from a [String] value.
static WebArchiveFormat? fromValue(String? value) {
if (value != null) {
try {
return WebArchiveFormat.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const WebArchiveFormat_._internal(this._value);
///Web Archive format used only by Android.
static const MHT = const WebArchiveFormat._internal("mht");
static const MHT = const WebArchiveFormat_._internal("mht");
///Web Archive format used only by iOS.
static const WEBARCHIVE = const WebArchiveFormat._internal("webarchive");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const WEBARCHIVE = const WebArchiveFormat_._internal("webarchive");
}

View File

@ -0,0 +1,74 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_archive_format.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the known Web Archive formats used when saving a web page.
class WebArchiveFormat {
final String _value;
final String _nativeValue;
const WebArchiveFormat._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebArchiveFormat._internalMultiPlatform(
String value, Function nativeValue) =>
WebArchiveFormat._internal(value, nativeValue());
///Web Archive format used only by Android.
static const MHT = WebArchiveFormat._internal('mht', 'mht');
///Web Archive format used only by iOS.
static const WEBARCHIVE =
WebArchiveFormat._internal('webarchive', 'webarchive');
///Set of all values of [WebArchiveFormat].
static final Set<WebArchiveFormat> values = [
WebArchiveFormat.MHT,
WebArchiveFormat.WEBARCHIVE,
].toSet();
///Gets a possible [WebArchiveFormat] instance from [String] value.
static WebArchiveFormat? fromValue(String? value) {
if (value != null) {
try {
return WebArchiveFormat.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebArchiveFormat] instance from a native value.
static WebArchiveFormat? fromNativeValue(String? value) {
if (value != null) {
try {
return WebArchiveFormat.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,57 +1,20 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'web_authentication_session_error.g.dart';
///Class that represents the error code for a web authentication session error.
class WebAuthenticationSessionError {
@ExchangeableEnum()
class WebAuthenticationSessionError_ {
// ignore: unused_field
final int _value;
const WebAuthenticationSessionError._internal(this._value);
///Set of all values of [WebAuthenticationSessionError].
static final Set<WebAuthenticationSessionError> values = [
WebAuthenticationSessionError.CANCELED_LOGIN,
WebAuthenticationSessionError.PRESENTATION_CONTEXT_NOT_PROVIDED,
WebAuthenticationSessionError.PRESENTATION_CONTEXT_INVALID
].toSet();
///Gets a possible [WebAuthenticationSessionError] instance from an [int] value.
static WebAuthenticationSessionError? fromValue(int? value) {
if (value != null) {
try {
return WebAuthenticationSessionError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "CANCELED_LOGIN";
case 2:
return "PRESENTATION_CONTEXT_NOT_PROVIDED";
case 3:
return "PRESENTATION_CONTEXT_INVALID";
default:
return "UNKNOWN";
}
}
const WebAuthenticationSessionError_._internal(this._value);
///The login has been canceled.
static final CANCELED_LOGIN = WebAuthenticationSessionError._internal(1);
static const CANCELED_LOGIN = WebAuthenticationSessionError_._internal(1);
///A context wasnt provided.
static final PRESENTATION_CONTEXT_NOT_PROVIDED = WebAuthenticationSessionError._internal(2);
static const PRESENTATION_CONTEXT_NOT_PROVIDED = WebAuthenticationSessionError_._internal(2);
///The context was invalid.
static final PRESENTATION_CONTEXT_INVALID = WebAuthenticationSessionError._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const PRESENTATION_CONTEXT_INVALID = WebAuthenticationSessionError_._internal(3);
}

View File

@ -0,0 +1,87 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_authentication_session_error.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the error code for a web authentication session error.
class WebAuthenticationSessionError {
final int _value;
final int _nativeValue;
const WebAuthenticationSessionError._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebAuthenticationSessionError._internalMultiPlatform(
int value, Function nativeValue) =>
WebAuthenticationSessionError._internal(value, nativeValue());
///The login has been canceled.
static const CANCELED_LOGIN = WebAuthenticationSessionError._internal(1, 1);
///A context wasnt provided.
static const PRESENTATION_CONTEXT_NOT_PROVIDED =
WebAuthenticationSessionError._internal(2, 2);
///The context was invalid.
static const PRESENTATION_CONTEXT_INVALID =
WebAuthenticationSessionError._internal(3, 3);
///Set of all values of [WebAuthenticationSessionError].
static final Set<WebAuthenticationSessionError> values = [
WebAuthenticationSessionError.CANCELED_LOGIN,
WebAuthenticationSessionError.PRESENTATION_CONTEXT_NOT_PROVIDED,
WebAuthenticationSessionError.PRESENTATION_CONTEXT_INVALID,
].toSet();
///Gets a possible [WebAuthenticationSessionError] instance from [int] value.
static WebAuthenticationSessionError? fromValue(int? value) {
if (value != null) {
try {
return WebAuthenticationSessionError.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebAuthenticationSessionError] instance from a native value.
static WebAuthenticationSessionError? fromNativeValue(int? value) {
if (value != null) {
try {
return WebAuthenticationSessionError.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 1:
return 'CANCELED_LOGIN';
case 2:
return 'PRESENTATION_CONTEXT_NOT_PROVIDED';
case 3:
return 'PRESENTATION_CONTEXT_INVALID';
}
return _value.toString();
}
}

View File

@ -1,61 +1,21 @@
import 'dart:collection';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'web_history_item.dart';
part 'web_history.g.dart';
///This class contains a snapshot of the current back/forward list for a [WebView].
class WebHistory {
@ExchangeableObject()
class WebHistory_ {
///List of all [WebHistoryItem]s.
List<WebHistoryItem>? list;
List<WebHistoryItem_>? list;
///Index of the current [WebHistoryItem].
int? currentIndex;
WebHistory({this.list, this.currentIndex});
///Gets a possible [WebHistory] instance from a [Map] value.
static WebHistory? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
List<LinkedHashMap<dynamic, dynamic>>? historyListMap =
map["history"]?.cast<LinkedHashMap<dynamic, dynamic>>();
int currentIndex = map["currentIndex"];
List<WebHistoryItem> historyList = <WebHistoryItem>[];
if (historyListMap != null) {
for (var i = 0; i < historyListMap.length; i++) {
var historyItem = historyListMap[i];
historyList.add(WebHistoryItem(
originalUrl: historyItem["originalUrl"] != null
? Uri.parse(historyItem["originalUrl"])
: null,
title: historyItem["title"],
url: historyItem["url"] != null
? Uri.parse(historyItem["url"])
: null,
index: i,
offset: i - currentIndex));
}
}
return WebHistory(list: historyList, currentIndex: currentIndex);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"list": list, "currentIndex": currentIndex};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
WebHistory_({this.list, this.currentIndex});
}

View File

@ -0,0 +1,48 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_history.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///This class contains a snapshot of the current back/forward list for a [WebView].
class WebHistory {
///List of all [WebHistoryItem]s.
List<WebHistoryItem>? list;
///Index of the current [WebHistoryItem].
int? currentIndex;
WebHistory({this.list, this.currentIndex});
///Gets a possible [WebHistory] instance from a [Map] value.
static WebHistory? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebHistory(
list: map['list']
?.map((e) => WebHistoryItem.fromMap(e?.cast<String, dynamic>())!),
currentIndex: map['currentIndex'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"list": list?.map((e) => e.toMap()).toList(),
"currentIndex": currentIndex,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebHistory{list: $list, currentIndex: $currentIndex}';
}
}

View File

@ -1,10 +1,15 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'web_history.dart';
part 'web_history_item.g.dart';
///A convenience class for accessing fields in an entry in the back/forward list of a [WebView].
///Each [WebHistoryItem] is a snapshot of the requested history item.
class WebHistoryItem {
@ExchangeableObject()
class WebHistoryItem_ {
///Original url of this history item.
Uri? originalUrl;
@ -20,27 +25,6 @@ class WebHistoryItem {
///Position offset respect to the currentIndex of the back-forward [WebHistory.list].
int? offset;
WebHistoryItem(
WebHistoryItem_(
{this.originalUrl, this.title, this.url, this.index, this.offset});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"originalUrl": originalUrl?.toString(),
"title": title,
"url": url?.toString(),
"index": index,
"offset": offset
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,65 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_history_item.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///A convenience class for accessing fields in an entry in the back/forward list of a [WebView].
///Each [WebHistoryItem] is a snapshot of the requested history item.
class WebHistoryItem {
///Original url of this history item.
Uri? originalUrl;
///Document title of this history item.
String? title;
///Url of this history item.
Uri? url;
///0-based position index in the back-forward [WebHistory.list].
int? index;
///Position offset respect to the currentIndex of the back-forward [WebHistory.list].
int? offset;
WebHistoryItem(
{this.originalUrl, this.title, this.url, this.index, this.offset});
///Gets a possible [WebHistoryItem] instance from a [Map] value.
static WebHistoryItem? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebHistoryItem(
originalUrl:
map['originalUrl'] != null ? Uri.parse(map['originalUrl']) : null,
title: map['title'],
url: map['url'] != null ? Uri.parse(map['url']) : null,
index: map['index'],
offset: map['offset'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"originalUrl": originalUrl?.toString(),
"title": title,
"url": url?.toString(),
"index": index,
"offset": offset,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebHistoryItem{originalUrl: $originalUrl, title: $title, url: $url, index: $index, offset: $offset}';
}
}

View File

@ -1,42 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'web_resource_error_type.dart';
part 'web_resource_error.g.dart';
///Encapsulates information about errors occurred during loading of web resources.
class WebResourceError {
@ExchangeableObject()
class WebResourceError_ {
///The type of the error.
WebResourceErrorType type;
WebResourceErrorType_ type;
///The string describing the error.
String description;
WebResourceError({required this.type, required this.description});
///Gets a possible [WebResourceError] instance from a [Map] value.
static WebResourceError? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return WebResourceError(
type: WebResourceErrorType.fromNativeValue(map["errorCode"])!,
description: map["description"]
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"description": description
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
WebResourceError_({required this.type, required this.description});
}

View File

@ -0,0 +1,47 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_resource_error.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Encapsulates information about errors occurred during loading of web resources.
class WebResourceError {
///The type of the error.
WebResourceErrorType type;
///The string describing the error.
String description;
WebResourceError({required this.type, required this.description});
///Gets a possible [WebResourceError] instance from a [Map] value.
static WebResourceError? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebResourceError(
type: WebResourceErrorType.fromNativeValue(map['type'])!,
description: map['description'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type.toNativeValue(),
"description": description,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebResourceError{type: $type, description: $description}';
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'web_resource_request.g.dart';
///Class representing a resource request of the [WebView].
class WebResourceRequest {
@ExchangeableObject()
class WebResourceRequest_ {
///The URL for which the resource request was made.
Uri url;
@ -33,48 +38,11 @@ class WebResourceRequest {
///**NOTE**: available on Android 21+. For Android < 21 it will be always `false`.
bool? isRedirect;
WebResourceRequest(
WebResourceRequest_(
{required this.url,
this.headers,
required this.method,
required this.hasGesture,
required this.isForMainFrame,
required this.isRedirect});
///Gets a possible [WebResourceRequest] instance from a [Map] value.
static WebResourceRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return WebResourceRequest(
url: Uri.parse(map["url"]),
headers: map["headers"]?.cast<String, String>(),
method: map["method"],
hasGesture: map["hasGesture"],
isForMainFrame: map["isForMainFrame"],
isRedirect: map["isRedirect"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"headers": headers,
"method": method,
"hasGesture": hasGesture,
"isForMainFrame": isForMainFrame,
"isRedirect": isRedirect
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.method,
this.hasGesture,
this.isForMainFrame,
this.isRedirect});
}

View File

@ -0,0 +1,86 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_resource_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing a resource request of the [WebView].
class WebResourceRequest {
///The URL for which the resource request was made.
Uri url;
///The headers associated with the request.
///
///**NOTE**: available on Android 21+. For Android < 21 it will be always `null`.
Map<String, String>? headers;
///The method associated with the request, for example `GET`.
///
///**NOTE**: available on Android 21+. For Android < 21 it will be always "GET".
String? method;
///Gets whether a gesture (such as a click) was associated with the request.
///For security reasons in certain situations this method may return `false` even though
///the sequence of events which caused the request to be created was initiated by a user
///gesture.
///
///**NOTE**: available on Android 21+. For Android < 21 it will be always `false`.
bool? hasGesture;
///Whether the request was made in order to fetch the main frame's document.
///
///**NOTE**: available on Android 21+. For Android < 21 it will be always `true`.
bool? isForMainFrame;
///Whether the request was a result of a server-side redirect.
///
///**NOTE**: available on Android 21+. For Android < 21 it will be always `false`.
bool? isRedirect;
WebResourceRequest(
{required this.url,
this.headers,
this.method,
this.hasGesture,
this.isForMainFrame,
this.isRedirect});
///Gets a possible [WebResourceRequest] instance from a [Map] value.
static WebResourceRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebResourceRequest(
url: Uri.parse(map['url']),
headers: map['headers'],
method: map['method'],
hasGesture: map['hasGesture'],
isForMainFrame: map['isForMainFrame'],
isRedirect: map['isRedirect'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"headers": headers,
"method": method,
"hasGesture": hasGesture,
"isForMainFrame": isForMainFrame,
"isRedirect": isRedirect,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebResourceRequest{url: $url, headers: $headers, method: $method, hasGesture: $hasGesture, isForMainFrame: $isForMainFrame, isRedirect: $isRedirect}';
}
}

View File

@ -1,9 +1,14 @@
import 'dart:typed_data';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'web_resource_response.g.dart';
///Class representing a resource response of the [WebView].
class WebResourceResponse {
@ExchangeableObject()
class WebResourceResponse_ {
///The resource response's MIME type, for example `text/html`.
String contentType;
@ -30,48 +35,11 @@ class WebResourceResponse {
///**NOTE**: available on Android 21+. For Android < 21 it won't be used.
String? reasonPhrase;
WebResourceResponse(
WebResourceResponse_(
{this.contentType = "",
this.contentEncoding = "utf-8",
this.data,
this.headers,
this.statusCode,
this.reasonPhrase});
///Gets a possible [WebResourceResponse] instance from a [Map] value.
static WebResourceResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return WebResourceResponse(
contentType: map["contentType"],
contentEncoding: map["contentEncoding"],
data: map["data"],
headers: map["headers"]?.cast<String, String>(),
statusCode: map["statusCode"],
reasonPhrase: map["reasonPhrase"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"contentType": contentType,
"contentEncoding": contentEncoding,
"data": data,
"headers": headers,
"statusCode": statusCode,
"reasonPhrase": reasonPhrase
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,81 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_resource_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing a resource response of the [WebView].
class WebResourceResponse {
///The resource response's MIME type, for example `text/html`.
String contentType;
///The resource response's encoding. The default value is `utf-8`.
String contentEncoding;
///The data provided by the resource response.
Uint8List? data;
///The headers for the resource response. If [headers] isn't `null`, then you need to set also [statusCode] and [reasonPhrase].
///
///**NOTE**: available on Android 21+. For Android < 21 it won't be used.
Map<String, String>? headers;
///The status code needs to be in the ranges [100, 299], [400, 599]. Causing a redirect by specifying a 3xx code is not supported.
///If statusCode is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
///
///**NOTE**: available on Android 21+. For Android < 21 it won't be used.
int? statusCode;
///The phrase describing the status code, for example `"OK"`. Must be non-empty.
///If reasonPhrase is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
///
///**NOTE**: available on Android 21+. For Android < 21 it won't be used.
String? reasonPhrase;
WebResourceResponse(
{this.contentType = "",
this.contentEncoding = "utf-8",
this.data,
this.headers,
this.statusCode,
this.reasonPhrase});
///Gets a possible [WebResourceResponse] instance from a [Map] value.
static WebResourceResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebResourceResponse(
data: map['data'],
headers: map['headers'],
statusCode: map['statusCode'],
reasonPhrase: map['reasonPhrase'],
);
instance.contentType = map['contentType'];
instance.contentEncoding = map['contentEncoding'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"contentType": contentType,
"contentEncoding": contentEncoding,
"data": data,
"headers": headers,
"statusCode": statusCode,
"reasonPhrase": reasonPhrase,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebResourceResponse{contentType: $contentType, contentEncoding: $contentEncoding, data: $data, headers: $headers, statusCode: $statusCode, reasonPhrase: $reasonPhrase}';
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../web_storage/web_storage_manager.dart';
import '../web_storage/android/web_storage_manager.dart';
part 'web_storage_origin.g.dart';
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
///An origin comprises the host, scheme and port of a URI. See [WebStorageManager] for details.
class WebStorageOrigin {
@ExchangeableObject()
class WebStorageOrigin_ {
///The string representation of this origin.
String? origin;
@ -13,29 +18,15 @@ class WebStorageOrigin {
///The total amount of storage currently being used by this origin, for all JavaScript storage APIs, in bytes.
int? usage;
WebStorageOrigin({this.origin, this.quota, this.usage});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"origin": origin, "quota": quota, "usage": usage};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
WebStorageOrigin_({this.origin, this.quota, this.usage});
}
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
///An origin comprises the host, scheme and port of a URI. See [AndroidWebStorageManager] for details.
///Use [WebStorageOrigin] instead.
@Deprecated("Use WebStorageOrigin instead")
class AndroidWebStorageOrigin {
@ExchangeableObject()
class AndroidWebStorageOrigin_ {
///The string representation of this origin.
String? origin;
@ -45,20 +36,5 @@ class AndroidWebStorageOrigin {
///The total amount of storage currently being used by this origin, for all JavaScript storage APIs, in bytes.
int? usage;
AndroidWebStorageOrigin({this.origin, this.quota, this.usage});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"origin": origin, "quota": quota, "usage": usage};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
AndroidWebStorageOrigin_({this.origin, this.quota, this.usage});
}

View File

@ -0,0 +1,101 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_storage_origin.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
///An origin comprises the host, scheme and port of a URI. See [WebStorageManager] for details.
class WebStorageOrigin {
///The string representation of this origin.
String? origin;
///The quota for this origin, for the Web SQL Database API, in bytes.
int? quota;
///The total amount of storage currently being used by this origin, for all JavaScript storage APIs, in bytes.
int? usage;
WebStorageOrigin({this.origin, this.quota, this.usage});
///Gets a possible [WebStorageOrigin] instance from a [Map] value.
static WebStorageOrigin? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebStorageOrigin(
origin: map['origin'],
quota: map['quota'],
usage: map['usage'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"origin": origin,
"quota": quota,
"usage": usage,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebStorageOrigin{origin: $origin, quota: $quota, usage: $usage}';
}
}
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
///An origin comprises the host, scheme and port of a URI. See [AndroidWebStorageManager] for details.
///Use [WebStorageOrigin] instead.
@Deprecated('Use WebStorageOrigin instead')
class AndroidWebStorageOrigin {
///The string representation of this origin.
String? origin;
///The quota for this origin, for the Web SQL Database API, in bytes.
int? quota;
///The total amount of storage currently being used by this origin, for all JavaScript storage APIs, in bytes.
int? usage;
AndroidWebStorageOrigin({this.origin, this.quota, this.usage});
///Gets a possible [AndroidWebStorageOrigin] instance from a [Map] value.
static AndroidWebStorageOrigin? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = AndroidWebStorageOrigin(
origin: map['origin'],
quota: map['quota'],
usage: map['usage'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"origin": origin,
"quota": quota,
"usage": usage,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'AndroidWebStorageOrigin{origin: $origin, quota: $quota, usage: $usage}';
}
}

View File

@ -1,47 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../web_storage/web_storage.dart';
part 'web_storage_type.g.dart';
///Class that represents the type of Web Storage: `localStorage` or `sessionStorage`.
///Used by the [Storage] class.
class WebStorageType {
@ExchangeableEnum()
class WebStorageType_ {
// ignore: unused_field
final String _value;
const WebStorageType._internal(this._value);
///Set of all values of [WebStorageType].
static final Set<WebStorageType> values = [
WebStorageType.LOCAL_STORAGE,
WebStorageType.SESSION_STORAGE,
].toSet();
///Gets a possible [WebStorageType] instance from a [String] value.
static WebStorageType? fromValue(String? value) {
if (value != null) {
try {
return WebStorageType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const WebStorageType_._internal(this._value);
///`window.localStorage`: same as [SESSION_STORAGE], but persists even when the browser is closed and reopened.
static const LOCAL_STORAGE = const WebStorageType._internal("localStorage");
static const LOCAL_STORAGE = const WebStorageType_._internal("localStorage");
///`window.sessionStorage`: maintains a separate storage area for each given origin that's available for the duration
///of the page session (as long as the browser is open, including page reloads and restores).
static const SESSION_STORAGE =
const WebStorageType._internal("sessionStorage");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const WebStorageType_._internal("sessionStorage");
}

View File

@ -0,0 +1,77 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'web_storage_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the type of Web Storage: `localStorage` or `sessionStorage`.
///Used by the [Storage] class.
class WebStorageType {
final String _value;
final String _nativeValue;
const WebStorageType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebStorageType._internalMultiPlatform(
String value, Function nativeValue) =>
WebStorageType._internal(value, nativeValue());
///`window.localStorage`: same as [SESSION_STORAGE], but persists even when the browser is closed and reopened.
static const LOCAL_STORAGE =
WebStorageType._internal('localStorage', 'localStorage');
///`window.sessionStorage`: maintains a separate storage area for each given origin that's available for the duration
///of the page session (as long as the browser is open, including page reloads and restores).
static const SESSION_STORAGE =
WebStorageType._internal('sessionStorage', 'sessionStorage');
///Set of all values of [WebStorageType].
static final Set<WebStorageType> values = [
WebStorageType.LOCAL_STORAGE,
WebStorageType.SESSION_STORAGE,
].toSet();
///Gets a possible [WebStorageType] instance from [String] value.
static WebStorageType? fromValue(String? value) {
if (value != null) {
try {
return WebStorageType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebStorageType] instance from a native value.
static WebStorageType? fromNativeValue(String? value) {
if (value != null) {
try {
return WebStorageType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,36 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'website_data_type.dart';
part 'website_data_record.g.dart';
///Class that represents website data, grouped by domain name using the public suffix list.
class WebsiteDataRecord {
@ExchangeableObject()
class WebsiteDataRecord_ {
///The display name for the data record. This is usually the domain name.
String? displayName;
///The various types of website data that exist for this data record.
Set<WebsiteDataType>? dataTypes;
Set<WebsiteDataType_>? dataTypes;
WebsiteDataRecord({this.displayName, this.dataTypes});
///Converts instance to a map.
Map<String, dynamic> toMap() {
List<String> dataTypesString = [];
if (dataTypes != null) {
for (var dataType in dataTypes!) {
dataTypesString.add(dataType.toValue());
}
}
return {"displayName": displayName, "dataTypes": dataTypesString};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
WebsiteDataRecord_({this.displayName, this.dataTypes});
}
///Class that represents website data, grouped by domain name using the public suffix list.
@ -39,34 +22,13 @@ class WebsiteDataRecord {
///
///Use [WebsiteDataRecord] instead.
@Deprecated("Use WebsiteDataRecord instead")
class IOSWKWebsiteDataRecord {
@ExchangeableObject()
class IOSWKWebsiteDataRecord_ {
///The display name for the data record. This is usually the domain name.
String? displayName;
///The various types of website data that exist for this data record.
Set<IOSWKWebsiteDataType>? dataTypes;
Set<IOSWKWebsiteDataType_>? dataTypes;
IOSWKWebsiteDataRecord({this.displayName, this.dataTypes});
///Converts instance to a map.
Map<String, dynamic> toMap() {
List<String> dataTypesString = [];
if (dataTypes != null) {
for (var dataType in dataTypes!) {
dataTypesString.add(dataType.toValue());
}
}
return {"displayName": displayName, "dataTypes": dataTypesString};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
IOSWKWebsiteDataRecord_({this.displayName, this.dataTypes});
}

View File

@ -0,0 +1,96 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'website_data_record.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents website data, grouped by domain name using the public suffix list.
class WebsiteDataRecord {
///The display name for the data record. This is usually the domain name.
String? displayName;
///The various types of website data that exist for this data record.
Set<WebsiteDataType>? dataTypes;
WebsiteDataRecord({this.displayName, this.dataTypes});
///Gets a possible [WebsiteDataRecord] instance from a [Map] value.
static WebsiteDataRecord? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebsiteDataRecord(
displayName: map['displayName'],
dataTypes: map['dataTypes']
?.map((e) => WebsiteDataType.fromNativeValue(e)!)
.toSet(),
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"displayName": displayName,
"dataTypes": dataTypes?.map((e) => e.toNativeValue()).toList(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebsiteDataRecord{displayName: $displayName, dataTypes: $dataTypes}';
}
}
///Class that represents website data, grouped by domain name using the public suffix list.
///
///**NOTE**: available on iOS 9.0+.
///
///Use [WebsiteDataRecord] instead.
@Deprecated('Use WebsiteDataRecord instead')
class IOSWKWebsiteDataRecord {
///The display name for the data record. This is usually the domain name.
String? displayName;
///The various types of website data that exist for this data record.
Set<IOSWKWebsiteDataType>? dataTypes;
IOSWKWebsiteDataRecord({this.displayName, this.dataTypes});
///Gets a possible [IOSWKWebsiteDataRecord] instance from a [Map] value.
static IOSWKWebsiteDataRecord? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = IOSWKWebsiteDataRecord(
displayName: map['displayName'],
dataTypes: map['dataTypes']
?.map((e) => IOSWKWebsiteDataType.fromNativeValue(e)!)
.toSet(),
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"displayName": displayName,
"dataTypes": dataTypes?.map((e) => e.toNativeValue()).toList(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'IOSWKWebsiteDataRecord{displayName: $displayName, dataTypes: $dataTypes}';
}
}

View File

@ -1,107 +1,75 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'website_data_type.g.dart';
///Class that represents a website data type.
class WebsiteDataType {
@ExchangeableEnum()
class WebsiteDataType_ {
// ignore: unused_field
final String _value;
const WebsiteDataType._internal(this._value);
///Set of all values of [WebsiteDataType].
static final Set<WebsiteDataType> values = [
WebsiteDataType.WKWebsiteDataTypeFetchCache,
WebsiteDataType.WKWebsiteDataTypeDiskCache,
WebsiteDataType.WKWebsiteDataTypeMemoryCache,
WebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
WebsiteDataType.WKWebsiteDataTypeCookies,
WebsiteDataType.WKWebsiteDataTypeSessionStorage,
WebsiteDataType.WKWebsiteDataTypeLocalStorage,
WebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
WebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
WebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations,
].toSet();
///Gets a possible [WebsiteDataType] instance from a [String] value.
static WebsiteDataType? fromValue(String? value) {
if (value != null) {
try {
return WebsiteDataType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const WebsiteDataType_._internal(this._value);
///On-disk Fetch caches.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeFetchCache =
const WebsiteDataType._internal("WKWebsiteDataTypeFetchCache");
const WebsiteDataType_._internal("WKWebsiteDataTypeFetchCache");
///On-disk caches.
static const WKWebsiteDataTypeDiskCache =
const WebsiteDataType._internal("WKWebsiteDataTypeDiskCache");
const WebsiteDataType_._internal("WKWebsiteDataTypeDiskCache");
///In-memory caches.
static const WKWebsiteDataTypeMemoryCache =
const WebsiteDataType._internal("WKWebsiteDataTypeMemoryCache");
const WebsiteDataType_._internal("WKWebsiteDataTypeMemoryCache");
///HTML offline web application caches.
static const WKWebsiteDataTypeOfflineWebApplicationCache =
const WebsiteDataType._internal(
const WebsiteDataType_._internal(
"WKWebsiteDataTypeOfflineWebApplicationCache");
///Cookies.
static const WKWebsiteDataTypeCookies =
const WebsiteDataType._internal("WKWebsiteDataTypeCookies");
const WebsiteDataType_._internal("WKWebsiteDataTypeCookies");
///HTML session storage.
static const WKWebsiteDataTypeSessionStorage =
const WebsiteDataType._internal("WKWebsiteDataTypeSessionStorage");
const WebsiteDataType_._internal("WKWebsiteDataTypeSessionStorage");
///HTML local storage.
static const WKWebsiteDataTypeLocalStorage =
const WebsiteDataType._internal("WKWebsiteDataTypeLocalStorage");
const WebsiteDataType_._internal("WKWebsiteDataTypeLocalStorage");
///WebSQL databases.
static const WKWebsiteDataTypeWebSQLDatabases =
const WebsiteDataType._internal("WKWebsiteDataTypeWebSQLDatabases");
const WebsiteDataType_._internal("WKWebsiteDataTypeWebSQLDatabases");
///IndexedDB databases.
static const WKWebsiteDataTypeIndexedDBDatabases =
const WebsiteDataType._internal("WKWebsiteDataTypeIndexedDBDatabases");
const WebsiteDataType_._internal("WKWebsiteDataTypeIndexedDBDatabases");
///Service worker registrations.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeServiceWorkerRegistrations =
const WebsiteDataType._internal(
const WebsiteDataType_._internal(
"WKWebsiteDataTypeServiceWorkerRegistrations");
///Returns a set of all available website data types.
@ExchangeableEnumCustomValue()
// ignore: non_constant_identifier_names
static final Set<WebsiteDataType> ALL = [
WebsiteDataType.WKWebsiteDataTypeFetchCache,
WebsiteDataType.WKWebsiteDataTypeDiskCache,
WebsiteDataType.WKWebsiteDataTypeMemoryCache,
WebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
WebsiteDataType.WKWebsiteDataTypeCookies,
WebsiteDataType.WKWebsiteDataTypeSessionStorage,
WebsiteDataType.WKWebsiteDataTypeLocalStorage,
WebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
WebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
WebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations
static final Set<WebsiteDataType_> ALL = [
WebsiteDataType_.WKWebsiteDataTypeFetchCache,
WebsiteDataType_.WKWebsiteDataTypeDiskCache,
WebsiteDataType_.WKWebsiteDataTypeMemoryCache,
WebsiteDataType_.WKWebsiteDataTypeOfflineWebApplicationCache,
WebsiteDataType_.WKWebsiteDataTypeCookies,
WebsiteDataType_.WKWebsiteDataTypeSessionStorage,
WebsiteDataType_.WKWebsiteDataTypeLocalStorage,
WebsiteDataType_.WKWebsiteDataTypeWebSQLDatabases,
WebsiteDataType_.WKWebsiteDataTypeIndexedDBDatabases,
WebsiteDataType_.WKWebsiteDataTypeServiceWorkerRegistrations
].toSet();
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}
///Class that represents a website data type.
@ -110,108 +78,72 @@ class WebsiteDataType {
///
///Use [WebsiteDataType] instead.
@Deprecated("Use WebsiteDataType instead")
class IOSWKWebsiteDataType {
@ExchangeableEnum()
class IOSWKWebsiteDataType_ {
// ignore: unused_field
final String _value;
const IOSWKWebsiteDataType._internal(this._value);
///Set of all values of [IOSWKWebsiteDataType].
static final Set<IOSWKWebsiteDataType> values = [
IOSWKWebsiteDataType.WKWebsiteDataTypeFetchCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeDiskCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeMemoryCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeCookies,
IOSWKWebsiteDataType.WKWebsiteDataTypeSessionStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeLocalStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations,
].toSet();
///Gets a possible [IOSWKWebsiteDataType] instance from a [String] value.
static IOSWKWebsiteDataType? fromValue(String? value) {
if (value != null) {
try {
return IOSWKWebsiteDataType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const IOSWKWebsiteDataType_._internal(this._value);
///On-disk Fetch caches.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeFetchCache =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeFetchCache");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeFetchCache");
///On-disk caches.
static const WKWebsiteDataTypeDiskCache =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeDiskCache");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeDiskCache");
///In-memory caches.
static const WKWebsiteDataTypeMemoryCache =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeMemoryCache");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeMemoryCache");
///HTML offline web application caches.
static const WKWebsiteDataTypeOfflineWebApplicationCache =
const IOSWKWebsiteDataType._internal(
const IOSWKWebsiteDataType_._internal(
"WKWebsiteDataTypeOfflineWebApplicationCache");
///Cookies.
static const WKWebsiteDataTypeCookies =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeCookies");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeCookies");
///HTML session storage.
static const WKWebsiteDataTypeSessionStorage =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeSessionStorage");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeSessionStorage");
///HTML local storage.
static const WKWebsiteDataTypeLocalStorage =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeLocalStorage");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeLocalStorage");
///WebSQL databases.
static const WKWebsiteDataTypeWebSQLDatabases =
const IOSWKWebsiteDataType._internal("WKWebsiteDataTypeWebSQLDatabases");
const IOSWKWebsiteDataType_._internal("WKWebsiteDataTypeWebSQLDatabases");
///IndexedDB databases.
static const WKWebsiteDataTypeIndexedDBDatabases =
const IOSWKWebsiteDataType._internal(
const IOSWKWebsiteDataType_._internal(
"WKWebsiteDataTypeIndexedDBDatabases");
///Service worker registrations.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeServiceWorkerRegistrations =
const IOSWKWebsiteDataType._internal(
const IOSWKWebsiteDataType_._internal(
"WKWebsiteDataTypeServiceWorkerRegistrations");
///Returns a set of all available website data types.
@ExchangeableEnumCustomValue()
// ignore: non_constant_identifier_names
static final Set<IOSWKWebsiteDataType> ALL = [
IOSWKWebsiteDataType.WKWebsiteDataTypeFetchCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeDiskCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeMemoryCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeCookies,
IOSWKWebsiteDataType.WKWebsiteDataTypeSessionStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeLocalStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations
static final Set<IOSWKWebsiteDataType_> ALL = [
IOSWKWebsiteDataType_.WKWebsiteDataTypeFetchCache,
IOSWKWebsiteDataType_.WKWebsiteDataTypeDiskCache,
IOSWKWebsiteDataType_.WKWebsiteDataTypeMemoryCache,
IOSWKWebsiteDataType_.WKWebsiteDataTypeOfflineWebApplicationCache,
IOSWKWebsiteDataType_.WKWebsiteDataTypeCookies,
IOSWKWebsiteDataType_.WKWebsiteDataTypeSessionStorage,
IOSWKWebsiteDataType_.WKWebsiteDataTypeLocalStorage,
IOSWKWebsiteDataType_.WKWebsiteDataTypeWebSQLDatabases,
IOSWKWebsiteDataType_.WKWebsiteDataTypeIndexedDBDatabases,
IOSWKWebsiteDataType_.WKWebsiteDataTypeServiceWorkerRegistrations
].toSet();
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}

View File

@ -0,0 +1,273 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'website_data_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents a website data type.
class WebsiteDataType {
final String _value;
final String _nativeValue;
const WebsiteDataType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebsiteDataType._internalMultiPlatform(
String value, Function nativeValue) =>
WebsiteDataType._internal(value, nativeValue());
///On-disk Fetch caches.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeFetchCache = WebsiteDataType._internal(
'WKWebsiteDataTypeFetchCache', 'WKWebsiteDataTypeFetchCache');
///On-disk caches.
static const WKWebsiteDataTypeDiskCache = WebsiteDataType._internal(
'WKWebsiteDataTypeDiskCache', 'WKWebsiteDataTypeDiskCache');
///In-memory caches.
static const WKWebsiteDataTypeMemoryCache = WebsiteDataType._internal(
'WKWebsiteDataTypeMemoryCache', 'WKWebsiteDataTypeMemoryCache');
///HTML offline web application caches.
static const WKWebsiteDataTypeOfflineWebApplicationCache =
WebsiteDataType._internal('WKWebsiteDataTypeOfflineWebApplicationCache',
'WKWebsiteDataTypeOfflineWebApplicationCache');
///Cookies.
static const WKWebsiteDataTypeCookies = WebsiteDataType._internal(
'WKWebsiteDataTypeCookies', 'WKWebsiteDataTypeCookies');
///HTML session storage.
static const WKWebsiteDataTypeSessionStorage = WebsiteDataType._internal(
'WKWebsiteDataTypeSessionStorage', 'WKWebsiteDataTypeSessionStorage');
///HTML local storage.
static const WKWebsiteDataTypeLocalStorage = WebsiteDataType._internal(
'WKWebsiteDataTypeLocalStorage', 'WKWebsiteDataTypeLocalStorage');
///WebSQL databases.
static const WKWebsiteDataTypeWebSQLDatabases = WebsiteDataType._internal(
'WKWebsiteDataTypeWebSQLDatabases', 'WKWebsiteDataTypeWebSQLDatabases');
///IndexedDB databases.
static const WKWebsiteDataTypeIndexedDBDatabases = WebsiteDataType._internal(
'WKWebsiteDataTypeIndexedDBDatabases',
'WKWebsiteDataTypeIndexedDBDatabases');
///Service worker registrations.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeServiceWorkerRegistrations =
WebsiteDataType._internal('WKWebsiteDataTypeServiceWorkerRegistrations',
'WKWebsiteDataTypeServiceWorkerRegistrations');
///Returns a set of all available website data types.
static final ALL = [
WebsiteDataType.WKWebsiteDataTypeFetchCache,
WebsiteDataType.WKWebsiteDataTypeDiskCache,
WebsiteDataType.WKWebsiteDataTypeMemoryCache,
WebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
WebsiteDataType.WKWebsiteDataTypeCookies,
WebsiteDataType.WKWebsiteDataTypeSessionStorage,
WebsiteDataType.WKWebsiteDataTypeLocalStorage,
WebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
WebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
WebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations
].toSet();
///Set of all values of [WebsiteDataType].
static final Set<WebsiteDataType> values = [
WebsiteDataType.WKWebsiteDataTypeFetchCache,
WebsiteDataType.WKWebsiteDataTypeDiskCache,
WebsiteDataType.WKWebsiteDataTypeMemoryCache,
WebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
WebsiteDataType.WKWebsiteDataTypeCookies,
WebsiteDataType.WKWebsiteDataTypeSessionStorage,
WebsiteDataType.WKWebsiteDataTypeLocalStorage,
WebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
WebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
WebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations,
].toSet();
///Gets a possible [WebsiteDataType] instance from [String] value.
static WebsiteDataType? fromValue(String? value) {
if (value != null) {
try {
return WebsiteDataType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebsiteDataType] instance from a native value.
static WebsiteDataType? fromNativeValue(String? value) {
if (value != null) {
try {
return WebsiteDataType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}
///Class that represents a website data type.
///
///**NOTE**: available on iOS 9.0+.
///
///Use [WebsiteDataType] instead.
@Deprecated('Use WebsiteDataType instead')
class IOSWKWebsiteDataType {
final String _value;
final String _nativeValue;
const IOSWKWebsiteDataType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSWKWebsiteDataType._internalMultiPlatform(
String value, Function nativeValue) =>
IOSWKWebsiteDataType._internal(value, nativeValue());
///On-disk Fetch caches.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeFetchCache = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeFetchCache', 'WKWebsiteDataTypeFetchCache');
///On-disk caches.
static const WKWebsiteDataTypeDiskCache = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeDiskCache', 'WKWebsiteDataTypeDiskCache');
///In-memory caches.
static const WKWebsiteDataTypeMemoryCache = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeMemoryCache', 'WKWebsiteDataTypeMemoryCache');
///HTML offline web application caches.
static const WKWebsiteDataTypeOfflineWebApplicationCache =
IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeOfflineWebApplicationCache',
'WKWebsiteDataTypeOfflineWebApplicationCache');
///Cookies.
static const WKWebsiteDataTypeCookies = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeCookies', 'WKWebsiteDataTypeCookies');
///HTML session storage.
static const WKWebsiteDataTypeSessionStorage = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeSessionStorage', 'WKWebsiteDataTypeSessionStorage');
///HTML local storage.
static const WKWebsiteDataTypeLocalStorage = IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeLocalStorage', 'WKWebsiteDataTypeLocalStorage');
///WebSQL databases.
static const WKWebsiteDataTypeWebSQLDatabases =
IOSWKWebsiteDataType._internal('WKWebsiteDataTypeWebSQLDatabases',
'WKWebsiteDataTypeWebSQLDatabases');
///IndexedDB databases.
static const WKWebsiteDataTypeIndexedDBDatabases =
IOSWKWebsiteDataType._internal('WKWebsiteDataTypeIndexedDBDatabases',
'WKWebsiteDataTypeIndexedDBDatabases');
///Service worker registrations.
///
///**NOTE**: available on iOS 11.3+.
static const WKWebsiteDataTypeServiceWorkerRegistrations =
IOSWKWebsiteDataType._internal(
'WKWebsiteDataTypeServiceWorkerRegistrations',
'WKWebsiteDataTypeServiceWorkerRegistrations');
///Returns a set of all available website data types.
static final ALL = [
IOSWKWebsiteDataType.WKWebsiteDataTypeFetchCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeDiskCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeMemoryCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeCookies,
IOSWKWebsiteDataType.WKWebsiteDataTypeSessionStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeLocalStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations
].toSet();
///Set of all values of [IOSWKWebsiteDataType].
static final Set<IOSWKWebsiteDataType> values = [
IOSWKWebsiteDataType.WKWebsiteDataTypeFetchCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeDiskCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeMemoryCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeOfflineWebApplicationCache,
IOSWKWebsiteDataType.WKWebsiteDataTypeCookies,
IOSWKWebsiteDataType.WKWebsiteDataTypeSessionStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeLocalStorage,
IOSWKWebsiteDataType.WKWebsiteDataTypeWebSQLDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeIndexedDBDatabases,
IOSWKWebsiteDataType.WKWebsiteDataTypeServiceWorkerRegistrations,
].toSet();
///Gets a possible [IOSWKWebsiteDataType] instance from [String] value.
static IOSWKWebsiteDataType? fromValue(String? value) {
if (value != null) {
try {
return IOSWKWebsiteDataType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSWKWebsiteDataType] instance from a native value.
static IOSWKWebsiteDataType? fromNativeValue(String? value) {
if (value != null) {
try {
return IOSWKWebsiteDataType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,45 +1,16 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'webview_implementation.g.dart';
///Class that represents the [WebView] native implementation to be used.
class WebViewImplementation {
@ExchangeableEnum()
class WebViewImplementation_ {
// ignore: unused_field
final int _value;
const WebViewImplementation_._internal(this._value);
const WebViewImplementation._internal(this._value);
///Set of all values of [WebViewImplementation].
static final Set<WebViewImplementation> values =
[WebViewImplementation.NATIVE].toSet();
///Gets a possible [WebViewImplementation] instance from an [int] value.
static WebViewImplementation? fromValue(int? value) {
if (value != null) {
try {
return WebViewImplementation.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 0:
default:
return "NATIVE";
}
}
///Default native implementation, such as `WKWebView` for iOS and `android.webkit.WebView` for Android.
static const NATIVE = const WebViewImplementation._internal(0);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
///Default native implementation, such as `WKWebView` for iOS and `android.webkit.WebView` for Android.
static const NATIVE = const WebViewImplementation_._internal(0);
}

View File

@ -0,0 +1,73 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'webview_implementation.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the [WebView] native implementation to be used.
class WebViewImplementation {
final int _value;
final int _nativeValue;
const WebViewImplementation._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebViewImplementation._internalMultiPlatform(
int value, Function nativeValue) =>
WebViewImplementation._internal(value, nativeValue());
///Default native implementation, such as `WKWebView` for iOS and `android.webkit.WebView` for Android.
static const NATIVE = WebViewImplementation._internal(0, 0);
///Set of all values of [WebViewImplementation].
static final Set<WebViewImplementation> values = [
WebViewImplementation.NATIVE,
].toSet();
///Gets a possible [WebViewImplementation] instance from [int] value.
static WebViewImplementation? fromValue(int? value) {
if (value != null) {
try {
return WebViewImplementation.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebViewImplementation] instance from a native value.
static WebViewImplementation? fromNativeValue(int? value) {
if (value != null) {
try {
return WebViewImplementation.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'NATIVE';
}
return _value.toString();
}
}

View File

@ -1,71 +1,31 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'webview_package_info.g.dart';
///Class that represents a [WebView] package info.
class WebViewPackageInfo {
@ExchangeableObject()
class WebViewPackageInfo_ {
///The version name of this WebView package.
String? versionName;
///The name of this WebView package.
String? packageName;
WebViewPackageInfo({this.versionName, this.packageName});
///Gets a possible [WebViewPackageInfo] instance from a [Map] value.
static WebViewPackageInfo? fromMap(Map<String, dynamic>? map) {
return map != null
? WebViewPackageInfo(
versionName: map["versionName"], packageName: map["packageName"])
: null;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"versionName": versionName, "packageName": packageName};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
WebViewPackageInfo_({this.versionName, this.packageName});
}
///Class that represents an Android [WebView] package info.
///Use [WebViewPackageInfo] instead.
@Deprecated("Use WebViewPackageInfo instead")
class AndroidWebViewPackageInfo {
@ExchangeableObject()
class AndroidWebViewPackageInfo_ {
///The version name of this WebView package.
String? versionName;
///The name of this WebView package.
String? packageName;
AndroidWebViewPackageInfo({this.versionName, this.packageName});
///Gets a possible [AndroidWebViewPackageInfo] instance from a [Map] value.
static AndroidWebViewPackageInfo? fromMap(Map<String, dynamic>? map) {
return map != null
? AndroidWebViewPackageInfo(
versionName: map["versionName"], packageName: map["packageName"])
: null;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"versionName": versionName, "packageName": packageName};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
AndroidWebViewPackageInfo_({this.versionName, this.packageName});
}

View File

@ -0,0 +1,89 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'webview_package_info.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a [WebView] package info.
class WebViewPackageInfo {
///The version name of this WebView package.
String? versionName;
///The name of this WebView package.
String? packageName;
WebViewPackageInfo({this.versionName, this.packageName});
///Gets a possible [WebViewPackageInfo] instance from a [Map] value.
static WebViewPackageInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WebViewPackageInfo(
versionName: map['versionName'],
packageName: map['packageName'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"versionName": versionName,
"packageName": packageName,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WebViewPackageInfo{versionName: $versionName, packageName: $packageName}';
}
}
///Class that represents an Android [WebView] package info.
///Use [WebViewPackageInfo] instead.
@Deprecated('Use WebViewPackageInfo instead')
class AndroidWebViewPackageInfo {
///The version name of this WebView package.
String? versionName;
///The name of this WebView package.
String? packageName;
AndroidWebViewPackageInfo({this.versionName, this.packageName});
///Gets a possible [AndroidWebViewPackageInfo] instance from a [Map] value.
static AndroidWebViewPackageInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = AndroidWebViewPackageInfo(
versionName: map['versionName'],
packageName: map['packageName'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"versionName": versionName,
"packageName": packageName,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'AndroidWebViewPackageInfo{versionName: $versionName, packageName: $packageName}';
}
}

View File

@ -1,24 +1,20 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'webview_render_process_action.g.dart';
///Class that represents the action to take used by the [WebView.onRenderProcessUnresponsive] and [WebView.onRenderProcessResponsive] event
///to terminate the Android [WebViewRenderProcess](https://developer.android.com/reference/android/webkit/WebViewRenderProcess).
class WebViewRenderProcessAction {
@ExchangeableEnum()
class WebViewRenderProcessAction_ {
// ignore: unused_field
final int _value;
const WebViewRenderProcessAction._internal(this._value);
const WebViewRenderProcessAction_._internal(this._value);
///Gets [int] value.
int toValue() => _value;
///Cause this renderer to terminate.
static const TERMINATE = const WebViewRenderProcessAction._internal(0);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
Map<String, dynamic> toMap() {
return {"action": _value};
}
static const TERMINATE = const WebViewRenderProcessAction_._internal(0);
}

View File

@ -0,0 +1,74 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'webview_render_process_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the action to take used by the [WebView.onRenderProcessUnresponsive] and [WebView.onRenderProcessResponsive] event
///to terminate the Android [WebViewRenderProcess](https://developer.android.com/reference/android/webkit/WebViewRenderProcess).
class WebViewRenderProcessAction {
final int _value;
final int _nativeValue;
const WebViewRenderProcessAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory WebViewRenderProcessAction._internalMultiPlatform(
int value, Function nativeValue) =>
WebViewRenderProcessAction._internal(value, nativeValue());
///Cause this renderer to terminate.
static const TERMINATE = WebViewRenderProcessAction._internal(0, 0);
///Set of all values of [WebViewRenderProcessAction].
static final Set<WebViewRenderProcessAction> values = [
WebViewRenderProcessAction.TERMINATE,
].toSet();
///Gets a possible [WebViewRenderProcessAction] instance from [int] value.
static WebViewRenderProcessAction? fromValue(int? value) {
if (value != null) {
try {
return WebViewRenderProcessAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [WebViewRenderProcessAction] instance from a native value.
static WebViewRenderProcessAction? fromNativeValue(int? value) {
if (value != null) {
try {
return WebViewRenderProcessAction.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'TERMINATE';
}
return _value.toString();
}
}

View File

@ -23,7 +23,7 @@ class IOSWebStorageManager {
List<IOSWKWebsiteDataRecord> recordList = [];
List<String> dataTypesList = [];
for (var dataType in dataTypes) {
dataTypesList.add(dataType.toValue());
dataTypesList.add(dataType.toNativeValue());
}
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("dataTypes", () => dataTypesList);
@ -55,7 +55,7 @@ class IOSWebStorageManager {
required List<IOSWKWebsiteDataRecord> dataRecords}) async {
List<String> dataTypesList = [];
for (var dataType in dataTypes) {
dataTypesList.add(dataType.toValue());
dataTypesList.add(dataType.toNativeValue());
}
List<Map<String, dynamic>> recordList = [];
@ -79,7 +79,7 @@ class IOSWebStorageManager {
required DateTime date}) async {
List<String> dataTypesList = [];
for (var dataType in dataTypes) {
dataTypesList.add(dataType.toValue());
dataTypesList.add(dataType.toNativeValue());
}
var timestamp = date.millisecondsSinceEpoch;

26
package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "flutter_inappwebview",
"version": "1.0.0",
"directories": {
"example": "example",
"lib": "lib",
"test": "test"
},
"private": true,
"scripts": {
"build": "flutter pub run build_runner build --delete-conflicting-outputs",
"watch": "flutter pub run build_runner watch --delete-conflicting-outputs",
"publish:dry": "npm run build && flutter pub publish --dry-run",
"publish": "npm run build && flutter pub publish"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pichillilorenzo/flutter_inappwebview.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/pichillilorenzo/flutter_inappwebview/issues"
},
"homepage": "https://github.com/pichillilorenzo/flutter_inappwebview#readme"
}

View File

@ -22,7 +22,7 @@ dev_dependencies:
flutter_driver:
sdk: flutter
lints: ^1.0.1
build_runner:
build_runner: ^2.2.1
generators:
path: dev_packages/generators

View File

@ -1 +1 @@
B83E5BFA72399E6B
B83E5BFA72399E73

Binary file not shown.

View File

@ -0,0 +1,20 @@
var fs = require('fs');
var https = require('https');
var options = {
hostname: 'localhost',
port: 4433,
path: '/',
method: 'GET',
key: fs.readFileSync('client1-key.pem'),
cert: fs.readFileSync('client1-crt.pem'),
// pfx: fs.readFileSync('certificate.pfx'),
ca: fs.readFileSync('ca-crt.pem') };
var req = https.request(options, function(res) {
res.on('data', function(data) {
process.stdout.write(data);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});

56
test_node_server/client1-crt.pem Executable file → Normal file
View File

@ -1,32 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFijCCA3KgAwIBAgIJALg+W/pyOZ5qMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
MIIFjDCCA3SgAwIBAgIJALg+W/pyOZ5yMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
VQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjETMBEGA1UECgwK
RXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkGA1UEAwwCY2ExIDAeBgkq
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMB4XDTE5MTAzMDIzMzcwOVoXDTIy
MDcyNTIzMzcwOVowgYYxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJNQTEPMA0GA1UE
BwwGQm9zdG9uMRMwEQYDVQQKDApFeGFtcGxlIENvMRAwDgYDVQQLDAd0ZWNob3Bz
MRAwDgYDVQQDDAdjbGllbnQxMSAwHgYJKoZIhvcNAQkBFhFjZXJ0c0BleGFtcGxl
LmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPWhU8of86y3Lols
0cU40+cbCcAhOEsdDiouVKX9cpnYoP5IIsTOiQHjAcMYekTMNXxLcGGa8FWO1bDW
6WjvzNi0s2xqYMThP5h7m5XK4PR6NjLnE8I0kyfYjvx4vN/AXNWJXgNDJ+dkm3O0
ceXzMzswuLqrhEv7UpkJm37znimOBtP7JSFmoz5mT+/s3Aojzop1Le1VSPVANIbu
PgdsIdoNMR8oJrKai0PourJKuvOV5qiNm0123+lq9x4R+zoY2AIB34o9RJfcuUZs
+IqDt+SyL3MHwuP8OMmYyU6yerfWLZ2Ywsg01uDGQMaHfPH1S8d8Hiq4Vwfi9RWE
kvifb4eQDBzVN3x1Hn/1cEghaLneDiRRwRiFZFs/WKvafxMOY4M30gpuSStHzIt/
wE+N8vC8KNW2TyyPAkCq6L8BjOlJ7EX0eilbSroMz/SeTO8+t4+N9vJ5/4e4dSSQ
zo3Sdw3K8sdK7zoBToWGW26yCSEvnSBjNyWvNKLWsHM1wKxbN85sDYdeyn7pvjHe
K1g0eQF/WGbEyHCTws3tDCo/wfpbZNtkW1w8zlBAmpbZdNZDs4769pZ/tb9wctUk
TasbXlXedMmmw2eOZ3d/hj0REFpbl/34ClQSTnlVQJKv/7CwqzJWDUd5uWzaHPtr
hzUOJDKoDBEvfL+yAEJNMM8maGcpAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGhm
496UQQKPqXUXl52lPUhchjCxecfukVrLf2GR3H8r9W6s46pu60MGZBip7TQowXGN
v4uZKABxOkI7VoRUhndsO8KiR39DlmE/SocSrEyfe6cblMaMr7c6oTojcYiXHLbi
Wy52O5TX1iqMBNyrvPAfDjOubkaUF0iuyh1Vzn5OuHvWfmC5uOONHIUCukeyg+hg
wxYH5vYduhYiqmdAPNHrqrGRqOfbwG6KTMaqH6xihupJsgcxwVpzbdWWxPU37tZE
sI1RVS26Z6XuA2j1uQ4BzRUbGlXqvESYV9jSkKYvNfMqVDL+g2h9xumlPtTIiP6b
GZIN4zel7WhaOdftnz5w4AdaPt3sYXxTda95973TNe072tgR/lJsvobW1szSo0k8
m2AbWeepzeKftYanCydRz5MnlOX8mf3HaL0QqreQwxaiF40mOUVcMPJfY2pK25qU
pVK9E3oA1ufc7+8Hnx4KsE9DO/1VyCrpBq0LwUKjmhYTLChsuH0Gpj+/pqioWNKB
c6Mt+APzGG8jqWrwMlsixK2U6G22zASpFBWuFhQIShkL819zgpRB67XPQUgKkbQT
4wF9cR4xwHvz8NsFHyXGFkI3U9yGGOVXWMOQ+ZhLyWGkwg096mVro/AtGveAs0sr
QWfJbuZM/gWlaojLGqtatDEc+tfRZ7g+nxU+PhQq
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMCAXDTIyMTAwMzExNTAwMloYDzIw
NTAwMjE3MTE1MDAyWjCBhjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1BMQ8wDQYD
VQQHDAZCb3N0b24xEzARBgNVBAoMCkV4YW1wbGUgQ28xEDAOBgNVBAsMB3RlY2hv
cHMxEDAOBgNVBAMMB2NsaWVudDExIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1w
bGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9aFTyh/zrLcu
iWzRxTjT5xsJwCE4Sx0OKi5Upf1ymdig/kgixM6JAeMBwxh6RMw1fEtwYZrwVY7V
sNbpaO/M2LSzbGpgxOE/mHublcrg9Ho2MucTwjSTJ9iO/Hi838Bc1YleA0Mn52Sb
c7Rx5fMzOzC4uquES/tSmQmbfvOeKY4G0/slIWajPmZP7+zcCiPOinUt7VVI9UA0
hu4+B2wh2g0xHygmspqLQ+i6skq685XmqI2bTXbf6Wr3HhH7OhjYAgHfij1El9y5
Rmz4ioO35LIvcwfC4/w4yZjJTrJ6t9YtnZjCyDTW4MZAxod88fVLx3weKrhXB+L1
FYSS+J9vh5AMHNU3fHUef/VwSCFoud4OJFHBGIVkWz9Yq9p/Ew5jgzfSCm5JK0fM
i3/AT43y8Lwo1bZPLI8CQKrovwGM6UnsRfR6KVtKugzP9J5M7z63j4328nn/h7h1
JJDOjdJ3Dcryx0rvOgFOhYZbbrIJIS+dIGM3Ja80otawczXArFs3zmwNh17Kfum+
Md4rWDR5AX9YZsTIcJPCze0MKj/B+ltk22RbXDzOUECaltl01kOzjvr2ln+1v3By
1SRNqxteVd50yabDZ45nd3+GPREQWluX/fgKVBJOeVVAkq//sLCrMlYNR3m5bNoc
+2uHNQ4kMqgMES98v7IAQk0wzyZoZykCAwEAATANBgkqhkiG9w0BAQUFAAOCAgEA
maEJnJAPmFi3FBDQdhnbyaJ41RqNjZKAQCmszWzDruPbw9G3RTBB2ziKsCq4uZzd
+YTtB2Bw0/7BcsCvdCdHjAg3X2kCrCE87t/WZC9fmAGRIsP2rZlvpCOg1K1yDzEN
Fwn3/MO9VMA954sHli/t4x+X7m7nwpoOPOpcgxRZGUbqGFbSG7Aih/aWojHLrXdG
0mDhy9JyTPcyRNMfFwVn/fpzw3M9bVrUxMKjWH9Yllse+UiCaTixmEyJcLdnssaO
k1VvAPv+j1IXtpe+4QOXenYlPCf/usbxBCXe3d1i1yovtWlZJnRY8HfMAbDQYbr0
ky04+9+kaqwZBcKYdCIpQ+Bim9/nb+NIvQXkknDQ7G6mf4cl8/wbvkGr52kEUktC
uRXTrBwiLWAhI0CfbAOcOBgS+COtzeZGCN+QG0+dV+0tQzGEt3wDizvdmsZJb3xq
8bFCHDYO2s4QiR2EmkPSvyHJ9D70hCYUYyZNJWeVx+zAQAs1Rr3NmeaLrw9ri9Cb
O0l274CaBxF5omP/wivzmIqsLR7ZfpdHrNpu8D6qKdstYN26IsET7vzNpYEpdN0m
RSs3PoP2M0prXxjZrmZVRMWLn56e2Ipl5s2ERNmjkrdY2pbPHxEqejbIox5zspNF
62eVeGs/3N7YdviQeVGUsbnXAJC5XiLkBjwYKpEJydI=
-----END CERTIFICATE-----

56
test_node_server/client2-crt.pem Executable file → Normal file
View File

@ -1,32 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFijCCA3KgAwIBAgIJALg+W/pyOZ5rMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
MIIFjDCCA3SgAwIBAgIJALg+W/pyOZ5zMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
VQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjETMBEGA1UECgwK
RXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkGA1UEAwwCY2ExIDAeBgkq
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMB4XDTE5MTAzMDIzMzcxNFoXDTIy
MDcyNTIzMzcxNFowgYYxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJNQTEPMA0GA1UE
BwwGQm9zdG9uMRMwEQYDVQQKDApFeGFtcGxlIENvMRAwDgYDVQQLDAd0ZWNob3Bz
MRAwDgYDVQQDDAdjbGllbnQyMSAwHgYJKoZIhvcNAQkBFhFjZXJ0c0BleGFtcGxl
LmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAO2ARFzN+hQgmnEj
OXHcOVjCPH6g/UNXwUNjtEUBg+EDTGliOC8If6ObFjW4tfIjwgGdhKt++92LRxDe
BauM8al7QK8yZhw7I7waqm0C4tIw4MdAlcRxZ0gEG7l5i9jU55yPpUcxZ1VE0VuH
ADgAosZtjltsBv03tq2Cf11jTEcaly4ze/8vDaAyl+M4u9FrflPnYoPmCiMBTz1j
1mdVtGsg2nGk+MA5RX9bMwWZq5bT9j2RG7PDMoc139SieQx4/5aVqIH628K7X0xE
/YydLh7vARM15Fn8tJy4yj/fgkU+3AWN8nWoOwceLNEB/yorBs1tjjSWEt3NIP7d
kcyHYmZ7XyUMSzlfdSVY+OoM1z63MoSCTwZJzZ5fI4ca+NtoxYny4unyM1q7QKwA
CisynJvGD5aI5bRgpjujlpw5IEuGqBZRjkLB0heOrPUlGEKkvaH2r9w/rGo8w4Is
ebz3OHBeVpB2AqbifMa+3cwZ9/IpRWUKUdnoqye5ySx1RHWmz3fjwerTDPzHWxJ8
YH8HORvuwUm+j/hXFvB3D8S754X+OEA8bgu/7dfIE1C330WDvVAP6EngCZKAI8W2
6u2SYXKPviqXciap5B4K4QHyUsiVruBIvymwTnz1+sharbRBOll7ZZKbBK1UNaCn
XO0Vt7NM5EbNEhjBlrArPGxIT0bFAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAD7W
3rD2n/PRT6U1TyInliTZ11+leG40+P+fhlXoajN8vwooCnoDZWQNXRYODekzC6t3
9jJWvbQyZnSL/jE81ixjN/CrHnrv1AmH63B3wgAaSYFja7UdfBE3rpb+ZsEZyjdu
54C1zsizwR85ZWUWoj22v3lzvmf0+FuqW9FxVREtZytePncfw40wFrQO9NX5QXo8
6ljZ18T7tNoeCv+C188SSbGNUDbC7VwTRCGACErbjAwX3ooQ5I2p3U3ipvTrXsnT
IYGeXwFqx7UjMtCYVJj8el+HlU1PZeyKZH/6j4HdseEZOvz8M/PSN8XjpStnhKQt
+dFmclEo68wU1KRnzUu38VynnKjSjeAZpws4eRqBr8rUeT8e52KbN07MLZ9q6GV7
V9MBERSIKNu7+PHIllvJCt3C3K0DGcq6ItNs5wOgtkXNI2RqovvtU2g6z1KdKthl
bVap4eh8WdVfYgFjTdiMFbLkFgZubNucyNXkKMPo79cnT1Wp1I3ZjNHuv7vtpXQD
WxfGZSsMM/ekgnR36wZFEqqt40bgie4RQJliIu1fWCVB6Y9kMb00dJ7otc8bIcVF
EZdTCbgdGvn91T9yN7yMXxoPmHq7WX6TG1hWVKLUAaiFAlJqFOg23fFj+6XlBD/G
/rGliGxn+1rvUywSv7oKVgTpbmwR65Fky2hDZWh5
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMCAXDTIyMTAwMzExNTAwNloYDzIw
NTAwMjE3MTE1MDA2WjCBhjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1BMQ8wDQYD
VQQHDAZCb3N0b24xEzARBgNVBAoMCkV4YW1wbGUgQ28xEDAOBgNVBAsMB3RlY2hv
cHMxEDAOBgNVBAMMB2NsaWVudDIxIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1w
bGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7YBEXM36FCCa
cSM5cdw5WMI8fqD9Q1fBQ2O0RQGD4QNMaWI4Lwh/o5sWNbi18iPCAZ2Eq3773YtH
EN4Fq4zxqXtArzJmHDsjvBqqbQLi0jDgx0CVxHFnSAQbuXmL2NTnnI+lRzFnVUTR
W4cAOACixm2OW2wG/Te2rYJ/XWNMRxqXLjN7/y8NoDKX4zi70Wt+U+dig+YKIwFP
PWPWZ1W0ayDacaT4wDlFf1szBZmrltP2PZEbs8MyhzXf1KJ5DHj/lpWogfrbwrtf
TET9jJ0uHu8BEzXkWfy0nLjKP9+CRT7cBY3ydag7Bx4s0QH/KisGzW2ONJYS3c0g
/t2RzIdiZntfJQxLOV91JVj46gzXPrcyhIJPBknNnl8jhxr422jFifLi6fIzWrtA
rAAKKzKcm8YPlojltGCmO6OWnDkgS4aoFlGOQsHSF46s9SUYQqS9ofav3D+sajzD
gix5vPc4cF5WkHYCpuJ8xr7dzBn38ilFZQpR2eirJ7nJLHVEdabPd+PB6tMM/Mdb
Enxgfwc5G+7BSb6P+FcW8HcPxLvnhf44QDxuC7/t18gTULffRYO9UA/oSeAJkoAj
xbbq7ZJhco++KpdyJqnkHgrhAfJSyJWu4Ei/KbBOfPX6yFqttEE6WXtlkpsErVQ1
oKdc7RW3s0zkRs0SGMGWsCs8bEhPRsUCAwEAATANBgkqhkiG9w0BAQUFAAOCAgEA
tW5aG5vAtjJyiof/eEQSTSDD9M2tp2+NPqXTNXvbE8MzqWd+6e6MQWV13eTnTYUo
qz66wlvCqlpedDu5eH2/BVewRFzk1wlPWFMZLFsPqWkoFNP4CfJjruQ+moyzO+Cy
KhXDPzI1rLsBmNQhUrG0nI1nfhmzeh0Vspj1mmIDP/0OjrPG5qsVZfDgFk352hLs
YdRK8Vbhggubj6N7uvRe2RdEtrYbboro6rtZV49b8EBtI2ILWsRR7G6KI/QOJBwf
9PsEQ3ZbmR9nWsVwR/snB+C3OQrHUVTGihcSiLikwomu4EbIYl2/oHcfJqr2b/Nb
l1n+bht1xkwPY5bwW45FvdKK1iKCNkJ+BwB89g+aBQGjh+ZyCMicLUjPxIxA5WEj
ei6S7NKtoCXG1wCrd58L2+8IKCXutCrH6XI26Lg2uSwaOiOwV6SlQ4JA8gEaMDMy
zfBI4i1ddePpjqMt56sKWaibgEFHE4jtzAs+lxNLY1XowTnk9upW3x1TfIO6wGKO
g5hKS2mRX5XIFic8MyniV4L1IMpn89Qf4e7UlgUyZ3ehDwpzfiK96wk1qCtTbiSG
SNN8nE5lC70CaxLF1igd2KCHLkS/2TeM2UMe0wU0jzNAwvVnJQ3jBy13JYThINnd
CBE+ZCYnvUtlUne4LnWtLf0zW3xboUHFtjllhFgs2OU=
-----END CERTIFICATE-----

View File

@ -1,13 +1,22 @@
// Example of the server https is taken from here: https://engineering.circle.com/https-authorized-certs-with-node-js-315e548354a2
// Renew certificates:
// - openssl x509 -req -extfile server.cnf -days 9999 -passin "pass:password" -in server-csr.pem -CA ca-crt.pem -CAkey ca-key.pem -CAcreateserial -out server-crt.pem
// - openssl x509 -req -extfile client1.cnf -days 9999 -passin "pass:password" -in client1-csr.pem -CA ca-crt.pem -CAkey ca-key.pem -CAcreateserial -out client1-crt.pem
// - openssl x509 -req -extfile client2.cnf -days 9999 -passin "pass:password" -in client2-csr.pem -CA ca-crt.pem -CAkey ca-key.pem -CAcreateserial -out client2-crt.pem
// Verify certificates:
// - openssl verify -CAfile ca-crt.pem server-crt.pem
// - openssl verify -CAfile ca-crt.pem client1-crt.pem
// - openssl verify -CAfile ca-crt.pem client2-crt.pem
// Conversion of client1-crt.pem to certificate.pfx: https://stackoverflow.com/a/38408666/4637638
const express = require('express');
const http = require('http');
const https = require('https');
const cors = require('cors');
const auth = require('basic-auth');
const app = express();
const appHttps = express();
const appAuthBasic = express();
// - openssl pkcs12 -export -out certificate.pfx -inkey client1-key.pem -in client1-crt.pem -certfile ca-crt.pem
// - Overwrite certificate.pfx to example/test_assets/certificate.pfx
const express = require('express')
const https = require('https')
const cors = require('cors')
const auth = require('basic-auth')
const app = express()
const appHttps = express()
const appAuthBasic = express()
const fs = require('fs')
const path = require('path')
const bodyParser = require('body-parser');
@ -198,21 +207,3 @@ app.get("/test-download-file", (req, res) => {
})
app.listen(8082)
// Proxy server
http.createServer(function (req, res) {
res.setHeader('Content-type', 'text/html');
res.write(`
<html>
<head>
</head>
<body>
<h1>Proxy Works</h1>
<p id="url">${req.url}</p>
<p id="method">${req.method}</p>
<p id="headers">${JSON.stringify(req.headers)}</p>
</body>
</html>
`);
res.end();
}).listen(8083);

190
test_node_server/package-lock.json generated Normal file → Executable file
View File

@ -1,5 +1,5 @@
{
"name": "test_node_server",
"name": "node_auth_basic",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
@ -11,6 +11,21 @@
"requires": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"dependencies": {
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
"mime-db": "1.52.0"
}
}
}
},
"array-flatten": {
@ -174,10 +189,98 @@
"vary": "~1.1.2"
},
"dependencies": {
"body-parser": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz",
"integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==",
"requires": {
"bytes": "3.1.2",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.10.3",
"raw-body": "2.5.1",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
}
},
"bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
},
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"requires": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"requires": {
"ee-first": "1.1.1"
}
},
"qs": {
"version": "6.10.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
"integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
"requires": {
"side-channel": "^1.0.4"
}
},
"raw-body": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
"requires": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
},
"toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
}
}
},
@ -193,6 +296,21 @@
"parseurl": "~1.3.3",
"statuses": "2.0.1",
"unpipe": "~1.0.0"
},
"dependencies": {
"on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"requires": {
"ee-first": "1.1.1"
}
},
"statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
}
}
},
"forwarded": {
@ -245,6 +363,11 @@
"toidentifier": "1.0.1"
}
},
"https": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz",
"integrity": "sha1-PDfHrhqO65ZpBKKtHpdaGUt+06Q="
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -284,16 +407,16 @@
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.52.0"
"mime-db": "1.44.0"
}
},
"ms": {
@ -314,7 +437,7 @@
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
"integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ=="
},
"http-errors": {
"version": "1.8.1",
@ -336,7 +459,7 @@
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
"integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA=="
}
}
},
@ -393,7 +516,7 @@
"random-bytes": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
"integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs="
"integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ=="
},
"range-parser": {
"version": "1.2.1",
@ -441,10 +564,55 @@
"statuses": "2.0.1"
},
"dependencies": {
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"requires": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"requires": {
"ee-first": "1.1.1"
}
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
},
"toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
}
}
},

View File

@ -1,19 +1,19 @@
{
"name": "test_node_server",
"name": "node_auth_basic",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"private": true,
"author": "",
"license": "MIT",
"license": "ISC",
"dependencies": {
"basic-auth": "^2.0.1",
"body-parser": "^1.19.0",
"basic-auth": "latest",
"body-parser": "^1.20.0",
"cors": "^2.8.5",
"express": "^4.18.1",
"multiparty": "^4.2.2"
"express": "latest",
"https": "latest",
"multiparty": "^4.2.3"
}
}

View File

@ -1,32 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFjDCCA3SgAwIBAgIJALg+W/pyOZ5pMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
MIIFjjCCA3agAwIBAgIJALg+W/pyOZ5xMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD
VQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjETMBEGA1UECgwK
RXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkGA1UEAwwCY2ExIDAeBgkq
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMB4XDTE5MTAzMDIzMzQxOVoXDTIy
MDcyNTIzMzQxOVowgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJNQTEPMA0GA1UE
BwwGQm9zdG9uMRMwEQYDVQQKDApFeGFtcGxlIENvMRAwDgYDVQQLDAd0ZWNob3Bz
MRIwEAYDVQQDDAlsb2NhbGhvc3QxIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1w
bGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA6+4m+blS6NcS
ZcftDArQhd7ekeeZzfiedonAXybjJ+GkqtigKW2hUtHldWRswx56braUAJYUsj2I
Xh9y9/vWCGUGF9ZsiPTI28bZgbfwvyGaO0K4mLPGdvOvtXgbbw3uC6hU+sbiFF88
BgZdwnsjoP7wPHqyzJ8PQ7BM7jdflLFn1uULS+9fe/7gPRSXxvS26WC1IYK8gVqQ
JBXH2tO3ZSh8LygePjKUWQF4xsN8mttRYlahdhNIMb1ZgBnG4rFq8JOc5fUbrYIz
s+LLMRm8zn3GIZgp4BiK900RJGxDXtVnx6ce4fdj+4OsL8NW3JzBNB66unsQ1gkz
WZbAbaXN7HeUpnktuGfA+TdWrzMd8XXaMDHXj9Uh8NtjToBJ5hHkStSkHRxBnlyo
MvWXGubn+EfUC5nVBGnG/Yfb9caKlpgIHh164ScGKlFlV4W8VpoA1W0BwE/R/E/I
lo5wiX5DP2uxh8bC7J1UK7guDnGDZASWsqNxtCBuCmEx9L6ePlnQbuc/AA+QLdyS
z4wb0IGefS+et0BOJFj2/u28/A5N21swarTCxPm0rczXZfRhooM8/X6Z3Pw6E5ze
D1S/49V8qLwqwcwkJhnIJoqSj/cWNGVXRY2Tqu5536NvK3e5BvOPeULf0IKYDhUs
LxwgpQ07gntS7UHBSejmmmjs92IiQiECAwEAATANBgkqhkiG9w0BAQUFAAOCAgEA
JxbqWQynzigBoaR7DP6AtXzYC2RcVBQuwyBSy348ruiIeQy3Niwt5cuhFA/LVyZP
QI6KQTj2Qd0elAkeSp55nG/ZWmcszAF8aWrFRNUc0U85eUcZSyKP1eRblFgf2sMg
HrJY0w0Ust43jk+tWNCftSHL6+uxaKc0z18vFmpHIBtpecCHYaA2mEUTTS19mzSu
K816jEqDvwxUWRbC8aTLOKDS3w1OLBtwVQ8bBvKCbJv7I3AmWtGkmDdetBwEe9u4
lpC/7Rmm57/UG5P8Vy7lVGyOnxQaTE1FxxNWwq02Iy4gc1UAovYYBtgsg+XfnpL6
TUo/9gtjl5K6OMxS/8JJjCi7U8RqiZICGTvjUvl0ahUtjs9CHtruWPbQ7tpA+IWQ
k9U708R3TAILHtq1Po1cWTtezYqUokLVwQlvwWJOezuPWnz0v5VKuLX64Ot0HAjI
rB/VggCRRFbxseM22q3xYKGpERhvAnSjD6bAYP11MlCj/4FBflHDWgDjTvmwRW05
GW7rsTT+4omu/yQGRXSqFpaD1pYuoi1j0Lhtk/LCwQLE9bxPBUf0t8Ut+q5s0s0X
yXB1git1Aq09HZ1yJRfL//g/PWOu5lFhc8Xe4grrB3peRl2yHNiBNXQ1m1DmxCpL
oeM+rfdX4oDVWH5oFmyFGAUOdsZ1JgvaasFq2JRKryA=
hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMCAXDTIyMTAwMzExNDk1OVoYDzIw
NTAwMjE3MTE0OTU5WjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1BMQ8wDQYD
VQQHDAZCb3N0b24xEzARBgNVBAoMCkV4YW1wbGUgQ28xEDAOBgNVBAsMB3RlY2hv
cHMxEjAQBgNVBAMMCWxvY2FsaG9zdDEgMB4GCSqGSIb3DQEJARYRY2VydHNAZXhh
bXBsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDr7ib5uVLo
1xJlx+0MCtCF3t6R55nN+J52icBfJuMn4aSq2KApbaFS0eV1ZGzDHnputpQAlhSy
PYheH3L3+9YIZQYX1myI9MjbxtmBt/C/IZo7QriYs8Z286+1eBtvDe4LqFT6xuIU
XzwGBl3CeyOg/vA8erLMnw9DsEzuN1+UsWfW5QtL7197/uA9FJfG9LbpYLUhgryB
WpAkFcfa07dlKHwvKB4+MpRZAXjGw3ya21FiVqF2E0gxvVmAGcbisWrwk5zl9Rut
gjOz4ssxGbzOfcYhmCngGIr3TREkbENe1WfHpx7h92P7g6wvw1bcnME0Hrq6exDW
CTNZlsBtpc3sd5SmeS24Z8D5N1avMx3xddowMdeP1SHw22NOgEnmEeRK1KQdHEGe
XKgy9Zca5uf4R9QLmdUEacb9h9v1xoqWmAgeHXrhJwYqUWVXhbxWmgDVbQHAT9H8
T8iWjnCJfkM/a7GHxsLsnVQruC4OcYNkBJayo3G0IG4KYTH0vp4+WdBu5z8AD5At
3JLPjBvQgZ59L563QE4kWPb+7bz8Dk3bWzBqtMLE+bStzNdl9GGigzz9fpnc/DoT
nN4PVL/j1XyovCrBzCQmGcgmipKP9xY0ZVdFjZOq7nnfo28rd7kG8495Qt/QgpgO
FSwvHCClDTuCe1LtQcFJ6OaaaOz3YiJCIQIDAQABMA0GCSqGSIb3DQEBBQUAA4IC
AQCGAFB075uCWhHnE8h7JF/fu9siRwpuUmLCDkIT5U8ToRwRAv+uqMhosCbaScKk
+Xq+1VhdLbt7b5NuEmlwOHv4GA7ru2pwJylLoxnmWh7i/DbTERIF8dal+TYV+VPD
3+M0KEQAlUIrza2u4iX7vZxkuHgN4/cCESFolsY6YYAhHZ2cR5Xeso/AKo1mVlvk
1agUMvdRCoqvF+IRN/mvCILyE8Pueq41YN3gPC6qFLh2Mnjs6vhx03Fb4CRYWqIM
/jRRRDMMb48j5t8EwCmu3j8tiCrfEC1XcaP8o720r7CJ5nw/O8lsQEfRDtcebSuq
+iHko9NTIztRW2U2EqDYKyxr+cojAD2xhVwQDpnXPzj1XGfKx4AoE/69tDFLng8i
PUWxo8Aa1TtZtcEmBzv2BCFBuqVkBPE/ZayeL5teDvyjUXVokNI3rXYeYLYqPly0
Qamm/fqnsd//tRgikeI+vHEUtcTCOqxmj3ELEf5PuITmtXGMUfAZZKAFU04h1Oxz
GQzOAuz+hnXA5RzlZA6y+r9HaL9bfu3CO59ITbZ/NVOW0toYCmuXR7oHLrF42JlH
MxdIatr942w/9yiJKCSZFnujwrerwOFn+7Utei/XASNXjUNc2HuMd+TfPSiM/YmM
pqiXXAYVskPHK9xG6w+YFhiLQ9KLOLSe7UXQZbs/NAxjXQ==
-----END CERTIFICATE-----