removed android and iOS methods cross-references
This commit is contained in:
parent
f3033b3407
commit
48aef55603
|
@ -86,11 +86,6 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
|
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
|
||||||
eventHandler?.onCompletedInitialLoad(didLoadSuccessfully);
|
eventHandler?.onCompletedInitialLoad(didLoadSuccessfully);
|
||||||
break;
|
break;
|
||||||
case "onInitialLoadDidRedirect":
|
|
||||||
final String? url = call.arguments["url"];
|
|
||||||
final WebUri? uri = url != null ? WebUri(url) : null;
|
|
||||||
eventHandler?.onInitialLoadDidRedirect(uri);
|
|
||||||
break;
|
|
||||||
case "onNavigationEvent":
|
case "onNavigationEvent":
|
||||||
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
|
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
|
||||||
call.arguments["navigationEvent"]);
|
call.arguments["navigationEvent"]);
|
||||||
|
@ -106,9 +101,6 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
eventHandler?.onRelationshipValidationResult(
|
eventHandler?.onRelationshipValidationResult(
|
||||||
relation, requestedOrigin, result);
|
relation, requestedOrigin, result);
|
||||||
break;
|
break;
|
||||||
case "onWillOpenInBrowser":
|
|
||||||
eventHandler?.onWillOpenInBrowser();
|
|
||||||
break;
|
|
||||||
case "onClosed":
|
case "onClosed":
|
||||||
_isOpened = false;
|
_isOpened = false;
|
||||||
final onClosed = eventHandler?.onClosed;
|
final onClosed = eventHandler?.onClosed;
|
||||||
|
@ -370,30 +362,6 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
return await _staticChannel.invokeMethod<String?>("getPackageName", args);
|
return await _staticChannel.invokeMethod<String?>("getPackageName", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> clearWebsiteData() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await _staticChannel.invokeMethod("clearWebsiteData", args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList());
|
|
||||||
Map<String, dynamic>? result =
|
|
||||||
(await _staticChannel.invokeMethod("prewarmConnections", args))
|
|
||||||
?.cast<String, dynamic>();
|
|
||||||
return PrewarmingToken.fromMap(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> invalidatePrewarmingToken(
|
|
||||||
PrewarmingToken prewarmingToken) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('prewarmingToken', () => prewarmingToken.toMap());
|
|
||||||
await _staticChannel.invokeMethod("invalidatePrewarmingToken", args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool isOpened() {
|
bool isOpened() {
|
||||||
return _isOpened;
|
return _isOpened;
|
||||||
|
|
|
@ -5,9 +5,6 @@ import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
||||||
|
|
||||||
import 'in_app_webview/headless_in_app_webview.dart';
|
|
||||||
import 'platform_util.dart';
|
|
||||||
|
|
||||||
/// Object specifying creation parameters for creating a [AndroidCookieManager].
|
/// Object specifying creation parameters for creating a [AndroidCookieManager].
|
||||||
///
|
///
|
||||||
/// When adding additional fields make sure they can be null or have a default
|
/// When adding additional fields make sure they can be null or have a default
|
||||||
|
@ -77,28 +74,11 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
@Deprecated("Use webViewController instead")
|
@Deprecated("Use webViewController instead")
|
||||||
PlatformInAppWebViewController? iosBelow11WebViewController,
|
PlatformInAppWebViewController? iosBelow11WebViewController,
|
||||||
PlatformInAppWebViewController? webViewController}) async {
|
PlatformInAppWebViewController? webViewController}) async {
|
||||||
webViewController = webViewController ?? iosBelow11WebViewController;
|
|
||||||
|
|
||||||
assert(url.toString().isNotEmpty);
|
assert(url.toString().isNotEmpty);
|
||||||
assert(name.isNotEmpty);
|
assert(name.isNotEmpty);
|
||||||
assert(value.isNotEmpty);
|
assert(value.isNotEmpty);
|
||||||
assert(path.isNotEmpty);
|
assert(path.isNotEmpty);
|
||||||
|
|
||||||
if (await _shouldUseJavascript()) {
|
|
||||||
await _setCookieWithJavaScript(
|
|
||||||
url: url,
|
|
||||||
name: name,
|
|
||||||
value: value,
|
|
||||||
domain: domain,
|
|
||||||
path: path,
|
|
||||||
expiresDate: expiresDate,
|
|
||||||
maxAge: maxAge,
|
|
||||||
isSecure: isSecure,
|
|
||||||
sameSite: sameSite,
|
|
||||||
webViewController: webViewController);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('url', () => url.toString());
|
args.putIfAbsent('url', () => url.toString());
|
||||||
args.putIfAbsent('name', () => name);
|
args.putIfAbsent('name', () => name);
|
||||||
|
@ -114,57 +94,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
return await channel?.invokeMethod<bool>('setCookie', args) ?? false;
|
return await channel?.invokeMethod<bool>('setCookie', args) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _setCookieWithJavaScript(
|
|
||||||
{required WebUri url,
|
|
||||||
required String name,
|
|
||||||
required String value,
|
|
||||||
String path = "/",
|
|
||||||
String? domain,
|
|
||||||
int? expiresDate,
|
|
||||||
int? maxAge,
|
|
||||||
bool? isSecure,
|
|
||||||
HTTPCookieSameSitePolicy? sameSite,
|
|
||||||
PlatformInAppWebViewController? webViewController}) async {
|
|
||||||
var cookieValue = name + "=" + value + "; Path=" + path;
|
|
||||||
|
|
||||||
if (domain != null) cookieValue += "; Domain=" + domain;
|
|
||||||
|
|
||||||
if (expiresDate != null)
|
|
||||||
cookieValue += "; Expires=" + await _getCookieExpirationDate(expiresDate);
|
|
||||||
|
|
||||||
if (maxAge != null) cookieValue += "; Max-Age=" + maxAge.toString();
|
|
||||||
|
|
||||||
if (isSecure != null && isSecure) cookieValue += "; Secure";
|
|
||||||
|
|
||||||
if (sameSite != null)
|
|
||||||
cookieValue += "; SameSite=" + sameSite.toNativeValue();
|
|
||||||
|
|
||||||
cookieValue += ";";
|
|
||||||
|
|
||||||
if (webViewController != null) {
|
|
||||||
final javaScriptEnabled =
|
|
||||||
(await webViewController.getSettings())?.javaScriptEnabled ?? false;
|
|
||||||
if (javaScriptEnabled) {
|
|
||||||
await webViewController.evaluateJavascript(
|
|
||||||
source: 'document.cookie="$cookieValue"');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final setCookieCompleter = Completer<void>();
|
|
||||||
final headlessWebView =
|
|
||||||
AndroidHeadlessInAppWebView(AndroidHeadlessInAppWebViewCreationParams(
|
|
||||||
initialUrlRequest: URLRequest(url: url),
|
|
||||||
onLoadStop: (controller, url) async {
|
|
||||||
await controller.evaluateJavascript(
|
|
||||||
source: 'document.cookie="$cookieValue"');
|
|
||||||
setCookieCompleter.complete();
|
|
||||||
}));
|
|
||||||
await headlessWebView.run();
|
|
||||||
await setCookieCompleter.future;
|
|
||||||
await headlessWebView.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<Cookie>> getCookies(
|
Future<List<Cookie>> getCookies(
|
||||||
{required WebUri url,
|
{required WebUri url,
|
||||||
|
@ -173,13 +102,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
PlatformInAppWebViewController? webViewController}) async {
|
PlatformInAppWebViewController? webViewController}) async {
|
||||||
assert(url.toString().isNotEmpty);
|
assert(url.toString().isNotEmpty);
|
||||||
|
|
||||||
webViewController = webViewController ?? iosBelow11WebViewController;
|
|
||||||
|
|
||||||
if (await _shouldUseJavascript()) {
|
|
||||||
return await _getCookiesWithJavaScript(
|
|
||||||
url: url, webViewController: webViewController);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Cookie> cookies = [];
|
List<Cookie> cookies = [];
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -204,64 +126,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Cookie>> _getCookiesWithJavaScript(
|
|
||||||
{required WebUri url,
|
|
||||||
PlatformInAppWebViewController? webViewController}) async {
|
|
||||||
assert(url.toString().isNotEmpty);
|
|
||||||
|
|
||||||
List<Cookie> cookies = [];
|
|
||||||
|
|
||||||
if (webViewController != null) {
|
|
||||||
final javaScriptEnabled =
|
|
||||||
(await webViewController.getSettings())?.javaScriptEnabled ?? false;
|
|
||||||
if (javaScriptEnabled) {
|
|
||||||
List<String> documentCookies = (await webViewController
|
|
||||||
.evaluateJavascript(source: 'document.cookie') as String)
|
|
||||||
.split(';')
|
|
||||||
.map((documentCookie) => documentCookie.trim())
|
|
||||||
.toList();
|
|
||||||
documentCookies.forEach((documentCookie) {
|
|
||||||
List<String> cookie = documentCookie.split('=');
|
|
||||||
if (cookie.length > 1) {
|
|
||||||
cookies.add(Cookie(
|
|
||||||
name: cookie[0],
|
|
||||||
value: cookie[1],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return cookies;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final pageLoaded = Completer<void>();
|
|
||||||
final headlessWebView =
|
|
||||||
AndroidHeadlessInAppWebView(AndroidHeadlessInAppWebViewCreationParams(
|
|
||||||
initialUrlRequest: URLRequest(url: url),
|
|
||||||
onLoadStop: (controller, url) async {
|
|
||||||
pageLoaded.complete();
|
|
||||||
},
|
|
||||||
));
|
|
||||||
await headlessWebView.run();
|
|
||||||
await pageLoaded.future;
|
|
||||||
|
|
||||||
List<String> documentCookies = (await headlessWebView.webViewController!
|
|
||||||
.evaluateJavascript(source: 'document.cookie') as String)
|
|
||||||
.split(';')
|
|
||||||
.map((documentCookie) => documentCookie.trim())
|
|
||||||
.toList();
|
|
||||||
documentCookies.forEach((documentCookie) {
|
|
||||||
List<String> cookie = documentCookie.split('=');
|
|
||||||
if (cookie.length > 1) {
|
|
||||||
cookies.add(Cookie(
|
|
||||||
name: cookie[0],
|
|
||||||
value: cookie[1],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await headlessWebView.dispose();
|
|
||||||
return cookies;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Cookie?> getCookie(
|
Future<Cookie?> getCookie(
|
||||||
{required WebUri url,
|
{required WebUri url,
|
||||||
|
@ -272,16 +136,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
assert(url.toString().isNotEmpty);
|
assert(url.toString().isNotEmpty);
|
||||||
assert(name.isNotEmpty);
|
assert(name.isNotEmpty);
|
||||||
|
|
||||||
webViewController = webViewController ?? iosBelow11WebViewController;
|
|
||||||
|
|
||||||
if (await _shouldUseJavascript()) {
|
|
||||||
List<Cookie> cookies = await _getCookiesWithJavaScript(
|
|
||||||
url: url, webViewController: webViewController);
|
|
||||||
return cookies
|
|
||||||
.cast<Cookie?>()
|
|
||||||
.firstWhere((cookie) => cookie!.name == name, orElse: () => null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('url', () => url.toString());
|
args.putIfAbsent('url', () => url.toString());
|
||||||
List<dynamic> cookies =
|
List<dynamic> cookies =
|
||||||
|
@ -317,20 +171,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
assert(url.toString().isNotEmpty);
|
assert(url.toString().isNotEmpty);
|
||||||
assert(name.isNotEmpty);
|
assert(name.isNotEmpty);
|
||||||
|
|
||||||
webViewController = webViewController ?? iosBelow11WebViewController;
|
|
||||||
|
|
||||||
if (await _shouldUseJavascript()) {
|
|
||||||
await _setCookieWithJavaScript(
|
|
||||||
url: url,
|
|
||||||
name: name,
|
|
||||||
value: "",
|
|
||||||
path: path,
|
|
||||||
domain: domain,
|
|
||||||
maxAge: -1,
|
|
||||||
webViewController: webViewController);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('url', () => url.toString());
|
args.putIfAbsent('url', () => url.toString());
|
||||||
args.putIfAbsent('name', () => name);
|
args.putIfAbsent('name', () => name);
|
||||||
|
@ -349,24 +189,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
PlatformInAppWebViewController? webViewController}) async {
|
PlatformInAppWebViewController? webViewController}) async {
|
||||||
assert(url.toString().isNotEmpty);
|
assert(url.toString().isNotEmpty);
|
||||||
|
|
||||||
webViewController = webViewController ?? iosBelow11WebViewController;
|
|
||||||
|
|
||||||
if (await _shouldUseJavascript()) {
|
|
||||||
List<Cookie> cookies = await _getCookiesWithJavaScript(
|
|
||||||
url: url, webViewController: webViewController);
|
|
||||||
for (var i = 0; i < cookies.length; i++) {
|
|
||||||
await _setCookieWithJavaScript(
|
|
||||||
url: url,
|
|
||||||
name: cookies[i].name,
|
|
||||||
value: "",
|
|
||||||
path: path,
|
|
||||||
domain: domain,
|
|
||||||
maxAge: -1,
|
|
||||||
webViewController: webViewController);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('url', () => url.toString());
|
args.putIfAbsent('url', () => url.toString());
|
||||||
args.putIfAbsent('domain', () => domain);
|
args.putIfAbsent('domain', () => domain);
|
||||||
|
@ -380,57 +202,6 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||||
await channel?.invokeMethod('deleteAllCookies', args);
|
await channel?.invokeMethod('deleteAllCookies', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<Cookie>> getAllCookies() async {
|
|
||||||
List<Cookie> cookies = [];
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
List<dynamic> cookieListMap =
|
|
||||||
await channel?.invokeMethod<List>('getAllCookies', args) ?? [];
|
|
||||||
cookieListMap = cookieListMap.cast<Map<dynamic, dynamic>>();
|
|
||||||
|
|
||||||
cookieListMap.forEach((cookieMap) {
|
|
||||||
cookies.add(Cookie(
|
|
||||||
name: cookieMap["name"],
|
|
||||||
value: cookieMap["value"],
|
|
||||||
expiresDate: cookieMap["expiresDate"],
|
|
||||||
isSessionOnly: cookieMap["isSessionOnly"],
|
|
||||||
domain: cookieMap["domain"],
|
|
||||||
sameSite:
|
|
||||||
HTTPCookieSameSitePolicy.fromNativeValue(cookieMap["sameSite"]),
|
|
||||||
isSecure: cookieMap["isSecure"],
|
|
||||||
isHttpOnly: cookieMap["isHttpOnly"],
|
|
||||||
path: cookieMap["path"]));
|
|
||||||
});
|
|
||||||
return cookies;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _getCookieExpirationDate(int expiresDate) async {
|
|
||||||
var platformUtil = PlatformUtil.instance();
|
|
||||||
var dateTime = DateTime.fromMillisecondsSinceEpoch(expiresDate).toUtc();
|
|
||||||
return !kIsWeb
|
|
||||||
? await platformUtil.formatDate(
|
|
||||||
date: dateTime,
|
|
||||||
format: 'EEE, dd MMM yyyy hh:mm:ss z',
|
|
||||||
locale: 'en_US',
|
|
||||||
timezone: 'GMT')
|
|
||||||
: await platformUtil.getWebCookieExpirationDate(date: dateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> _shouldUseJavascript() async {
|
|
||||||
if (Util.isWeb) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Util.isIOS || Util.isMacOS) {
|
|
||||||
final platformUtil = PlatformUtil.instance();
|
|
||||||
final systemVersion = await platformUtil.getSystemVersion();
|
|
||||||
return Util.isIOS
|
|
||||||
? systemVersion.compareTo("11") == -1
|
|
||||||
: systemVersion.compareTo("10.13") == -1;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// empty
|
// empty
|
||||||
|
|
|
@ -98,30 +98,6 @@ class AndroidFindInteractionController extends PlatformFindInteractionController
|
||||||
return await channel?.invokeMethod<String?>('getSearchText', args);
|
return await channel?.invokeMethod<String?>('getSearchText', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.isFindNavigatorVisible}
|
|
||||||
Future<bool?> isFindNavigatorVisible() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool?>('isFindNavigatorVisible', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.updateResultCount}
|
|
||||||
Future<void> updateResultCount() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('updateResultCount', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.presentFindNavigator}
|
|
||||||
Future<void> presentFindNavigator() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('presentFindNavigator', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.dismissFindNavigator}
|
|
||||||
Future<void> dismissFindNavigator() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('dismissFindNavigator', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getActiveFindSession}
|
///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getActiveFindSession}
|
||||||
Future<FindSession?> getActiveFindSession() async {
|
Future<FindSession?> getActiveFindSession() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -1923,7 +1923,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
args.putIfAbsent('source', () => source);
|
args.putIfAbsent('source', () => source);
|
||||||
args.putIfAbsent('contentWorld', () => contentWorld?.toMap());
|
args.putIfAbsent('contentWorld', () => contentWorld?.toMap());
|
||||||
var data = await channel?.invokeMethod('evaluateJavascript', args);
|
var data = await channel?.invokeMethod('evaluateJavascript', args);
|
||||||
if (data != null && (Util.isAndroid || Util.isWeb)) {
|
if (data != null) {
|
||||||
try {
|
try {
|
||||||
// try to json decode the data coming from JavaScript
|
// try to json decode the data coming from JavaScript
|
||||||
// otherwise return it as it is.
|
// otherwise return it as it is.
|
||||||
|
@ -2185,8 +2185,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
{required double zoomFactor,
|
{required double zoomFactor,
|
||||||
@Deprecated('Use animated instead') bool? iosAnimated,
|
@Deprecated('Use animated instead') bool? iosAnimated,
|
||||||
bool animated = false}) async {
|
bool animated = false}) async {
|
||||||
assert(!Util.isAndroid ||
|
assert(zoomFactor > 0.01 && zoomFactor <= 100.0);
|
||||||
(Util.isAndroid && zoomFactor > 0.01 && zoomFactor <= 100.0));
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('zoomFactor', () => zoomFactor);
|
args.putIfAbsent('zoomFactor', () => zoomFactor);
|
||||||
|
@ -2398,8 +2397,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> addUserScript({required UserScript userScript}) async {
|
Future<void> addUserScript({required UserScript userScript}) async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('userScript', () => userScript.toMap());
|
args.putIfAbsent('userScript', () => userScript.toMap());
|
||||||
if (!(_userScripts[userScript.injectionTime]?.contains(userScript) ??
|
if (!(_userScripts[userScript.injectionTime]?.contains(userScript) ??
|
||||||
|
@ -2411,8 +2408,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> addUserScripts({required List<UserScript> userScripts}) async {
|
Future<void> addUserScripts({required List<UserScript> userScripts}) async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
|
||||||
|
|
||||||
for (var i = 0; i < userScripts.length; i++) {
|
for (var i = 0; i < userScripts.length; i++) {
|
||||||
await addUserScript(userScript: userScripts[i]);
|
await addUserScript(userScript: userScripts[i]);
|
||||||
}
|
}
|
||||||
|
@ -2420,8 +2415,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> removeUserScript({required UserScript userScript}) async {
|
Future<bool> removeUserScript({required UserScript userScript}) async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
|
||||||
|
|
||||||
var index = _userScripts[userScript.injectionTime]?.indexOf(userScript);
|
var index = _userScripts[userScript.injectionTime]?.indexOf(userScript);
|
||||||
if (index == null || index == -1) {
|
if (index == null || index == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2438,8 +2431,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> removeUserScriptsByGroupName({required String groupName}) async {
|
Future<void> removeUserScriptsByGroupName({required String groupName}) async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
|
||||||
|
|
||||||
final List<UserScript> userScriptsAtDocumentStart = List.from(
|
final List<UserScript> userScriptsAtDocumentStart = List.from(
|
||||||
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START] ?? []);
|
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START] ?? []);
|
||||||
for (final userScript in userScriptsAtDocumentStart) {
|
for (final userScript in userScriptsAtDocumentStart) {
|
||||||
|
@ -2464,17 +2455,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
@override
|
@override
|
||||||
Future<void> removeUserScripts(
|
Future<void> removeUserScripts(
|
||||||
{required List<UserScript> userScripts}) async {
|
{required List<UserScript> userScripts}) async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
for (final userScript in userScripts) {
|
||||||
|
|
||||||
for (final userScript in userScripts) {
|
|
||||||
await removeUserScript(userScript: userScript);
|
await removeUserScript(userScript: userScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> removeAllUserScripts() async {
|
Future<void> removeAllUserScripts() async {
|
||||||
assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS));
|
|
||||||
|
|
||||||
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START]?.clear();
|
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_START]?.clear();
|
||||||
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_END]?.clear();
|
_userScripts[UserScriptInjectionTime.AT_DOCUMENT_END]?.clear();
|
||||||
|
|
||||||
|
@ -2501,9 +2488,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (Util.isAndroid) {
|
data = json.decode(data);
|
||||||
data = json.decode(data);
|
|
||||||
}
|
|
||||||
return CallAsyncJavaScriptResult(
|
return CallAsyncJavaScriptResult(
|
||||||
value: data["value"], error: data["error"]);
|
value: data["value"], error: data["error"]);
|
||||||
}
|
}
|
||||||
|
@ -2512,12 +2497,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
Future<String?> saveWebArchive(
|
Future<String?> saveWebArchive(
|
||||||
{required String filePath, bool autoname = false}) async {
|
{required String filePath, bool autoname = false}) async {
|
||||||
if (!autoname) {
|
if (!autoname) {
|
||||||
if (Util.isAndroid) {
|
assert(filePath.endsWith("." + WebArchiveFormat.MHT.toNativeValue()));
|
||||||
assert(filePath.endsWith("." + WebArchiveFormat.MHT.toNativeValue()));
|
|
||||||
} else if (Util.isIOS || Util.isMacOS) {
|
|
||||||
assert(filePath
|
|
||||||
.endsWith("." + WebArchiveFormat.WEBARCHIVE.toNativeValue()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -2652,116 +2632,12 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
return await channel?.invokeMethod('clearHistory', args);
|
return await channel?.invokeMethod('clearHistory', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> reloadFromOrigin() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('reloadFromOrigin', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Uint8List?> createPdf(
|
|
||||||
{@Deprecated("Use pdfConfiguration instead")
|
|
||||||
// ignore: deprecated_member_use_from_same_package
|
|
||||||
IOSWKPDFConfiguration? iosWKPdfConfiguration,
|
|
||||||
PDFConfiguration? pdfConfiguration}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('pdfConfiguration',
|
|
||||||
() => pdfConfiguration?.toMap() ?? iosWKPdfConfiguration?.toMap());
|
|
||||||
return await channel?.invokeMethod<Uint8List?>('createPdf', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Uint8List?> createWebArchiveData() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod('createWebArchiveData', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> hasOnlySecureContent() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool>('hasOnlySecureContent', args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> pauseAllMediaPlayback() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod('pauseAllMediaPlayback', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setAllMediaPlaybackSuspended({required bool suspended}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("suspended", () => suspended);
|
|
||||||
return await channel?.invokeMethod('setAllMediaPlaybackSuspended', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> closeAllMediaPresentations() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod('closeAllMediaPresentations', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<MediaPlaybackState?> requestMediaPlaybackState() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return MediaPlaybackState.fromNativeValue(
|
|
||||||
await channel?.invokeMethod('requestMediaPlaybackState', args));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> isInFullscreen() async {
|
Future<bool> isInFullscreen() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
return await channel?.invokeMethod<bool>('isInFullscreen', args) ?? false;
|
return await channel?.invokeMethod<bool>('isInFullscreen', args) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<MediaCaptureState?> getCameraCaptureState() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return MediaCaptureState.fromNativeValue(
|
|
||||||
await channel?.invokeMethod('getCameraCaptureState', args));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setCameraCaptureState({required MediaCaptureState state}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('state', () => state.toNativeValue());
|
|
||||||
await channel?.invokeMethod('setCameraCaptureState', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<MediaCaptureState?> getMicrophoneCaptureState() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return MediaCaptureState.fromNativeValue(
|
|
||||||
await channel?.invokeMethod('getMicrophoneCaptureState', args));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setMicrophoneCaptureState(
|
|
||||||
{required MediaCaptureState state}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('state', () => state.toNativeValue());
|
|
||||||
await channel?.invokeMethod('setMicrophoneCaptureState', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> loadSimulatedRequest(
|
|
||||||
{required URLRequest urlRequest,
|
|
||||||
required Uint8List data,
|
|
||||||
URLResponse? urlResponse}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('urlRequest', () => urlRequest.toMap());
|
|
||||||
args.putIfAbsent('data', () => data);
|
|
||||||
args.putIfAbsent('urlResponse', () => urlResponse?.toMap());
|
|
||||||
await channel?.invokeMethod('loadSimulatedRequest', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getIFrameId() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<String?>('getIFrameId', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> getDefaultUserAgent() async {
|
Future<String> getDefaultUserAgent() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -2837,13 +2713,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
|
||||||
await _staticChannel.invokeMethod('disableWebView', args);
|
await _staticChannel.invokeMethod('disableWebView', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> handlesURLScheme(String urlScheme) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('urlScheme', () => urlScheme);
|
|
||||||
return await _staticChannel.invokeMethod('handlesURLScheme', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> disposeKeepAlive(InAppWebViewKeepAlive keepAlive) async {
|
Future<void> disposeKeepAlive(InAppWebViewKeepAlive keepAlive) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -43,13 +43,6 @@ class AndroidPrintJobController extends PlatformPrintJobController
|
||||||
|
|
||||||
Future<dynamic> _handleMethod(MethodCall call) async {
|
Future<dynamic> _handleMethod(MethodCall call) async {
|
||||||
switch (call.method) {
|
switch (call.method) {
|
||||||
case "onComplete":
|
|
||||||
bool completed = call.arguments["completed"];
|
|
||||||
String? error = call.arguments["error"];
|
|
||||||
if (params.onComplete != null) {
|
|
||||||
params.onComplete!(completed, error);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw UnimplementedError("Unimplemented ${call.method} method");
|
throw UnimplementedError("Unimplemented ${call.method} method");
|
||||||
}
|
}
|
||||||
|
@ -67,13 +60,6 @@ class AndroidPrintJobController extends PlatformPrintJobController
|
||||||
await channel?.invokeMethod('restart', args);
|
await channel?.invokeMethod('restart', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> dismiss({bool animated: true}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("animated", () => animated);
|
|
||||||
await channel?.invokeMethod('dismiss', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<PrintJobInfo?> getInfo() async {
|
Future<PrintJobInfo?> getInfo() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -147,21 +147,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController
|
||||||
await channel?.invokeMethod('setSize', args);
|
await channel?.invokeMethod('setSize', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use setStyledTitle instead")
|
|
||||||
@override
|
|
||||||
Future<void> setAttributedTitle(IOSNSAttributedString attributedTitle) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('attributedTitle', () => attributedTitle.toMap());
|
|
||||||
await channel?.invokeMethod('setStyledTitle', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setStyledTitle(AttributedString attributedTitle) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('attributedTitle', () => attributedTitle.toMap());
|
|
||||||
await channel?.invokeMethod('setStyledTitle', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose({bool isKeepAlive = false}) {
|
void dispose({bool isKeepAlive = false}) {
|
||||||
disposeChannel(removeMethodCallHandler: !isKeepAlive);
|
disposeChannel(removeMethodCallHandler: !isKeepAlive);
|
||||||
|
|
|
@ -105,71 +105,6 @@ class AndroidWebStorageManager extends PlatformWebStorageManager
|
||||||
return await channel?.invokeMethod<int>('getUsageForOrigin', args) ?? 0;
|
return await channel?.invokeMethod<int>('getUsageForOrigin', args) ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<WebsiteDataRecord>> fetchDataRecords(
|
|
||||||
{required Set<WebsiteDataType> dataTypes}) async {
|
|
||||||
List<WebsiteDataRecord> recordList = [];
|
|
||||||
List<String> dataTypesList = [];
|
|
||||||
for (var dataType in dataTypes) {
|
|
||||||
dataTypesList.add(dataType.toNativeValue());
|
|
||||||
}
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("dataTypes", () => dataTypesList);
|
|
||||||
List<Map<dynamic, dynamic>> records =
|
|
||||||
(await channel?.invokeMethod<List>('fetchDataRecords', args))
|
|
||||||
?.cast<Map<dynamic, dynamic>>() ??
|
|
||||||
[];
|
|
||||||
for (var record in records) {
|
|
||||||
List<String> dataTypesString = record["dataTypes"].cast<String>();
|
|
||||||
Set<WebsiteDataType> dataTypes = Set();
|
|
||||||
for (var dataTypeValue in dataTypesString) {
|
|
||||||
var dataType = WebsiteDataType.fromNativeValue(dataTypeValue);
|
|
||||||
if (dataType != null) {
|
|
||||||
dataTypes.add(dataType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recordList.add(WebsiteDataRecord(
|
|
||||||
displayName: record["displayName"], dataTypes: dataTypes));
|
|
||||||
}
|
|
||||||
return recordList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> removeDataFor(
|
|
||||||
{required Set<WebsiteDataType> dataTypes,
|
|
||||||
required List<WebsiteDataRecord> dataRecords}) async {
|
|
||||||
List<String> dataTypesList = [];
|
|
||||||
for (var dataType in dataTypes) {
|
|
||||||
dataTypesList.add(dataType.toNativeValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String, dynamic>> recordList = [];
|
|
||||||
for (var record in dataRecords) {
|
|
||||||
recordList.add(record.toMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("dataTypes", () => dataTypesList);
|
|
||||||
args.putIfAbsent("recordList", () => recordList);
|
|
||||||
await channel?.invokeMethod('removeDataFor', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> removeDataModifiedSince(
|
|
||||||
{required Set<WebsiteDataType> dataTypes, required DateTime date}) async {
|
|
||||||
List<String> dataTypesList = [];
|
|
||||||
for (var dataType in dataTypes) {
|
|
||||||
dataTypesList.add(dataType.toNativeValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
var timestamp = date.millisecondsSinceEpoch;
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("dataTypes", () => dataTypesList);
|
|
||||||
args.putIfAbsent("timestamp", () => timestamp);
|
|
||||||
await channel?.invokeMethod('removeDataModifiedSince', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// empty
|
// empty
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -49,9 +48,7 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
return _staticValue;
|
return _staticValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChromeSafariBrowserActionButton? _actionButton;
|
|
||||||
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
||||||
ChromeSafariBrowserSecondaryToolbar? _secondaryToolbar;
|
|
||||||
bool _isOpened = false;
|
bool _isOpened = false;
|
||||||
static const MethodChannel _staticChannel =
|
static const MethodChannel _staticChannel =
|
||||||
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
||||||
|
@ -76,9 +73,6 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
_debugLog(call.method, call.arguments);
|
_debugLog(call.method, call.arguments);
|
||||||
|
|
||||||
switch (call.method) {
|
switch (call.method) {
|
||||||
case "onServiceConnected":
|
|
||||||
eventHandler?.onServiceConnected();
|
|
||||||
break;
|
|
||||||
case "onOpened":
|
case "onOpened":
|
||||||
eventHandler?.onOpened();
|
eventHandler?.onOpened();
|
||||||
break;
|
break;
|
||||||
|
@ -91,21 +85,6 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
final WebUri? uri = url != null ? WebUri(url) : null;
|
final WebUri? uri = url != null ? WebUri(url) : null;
|
||||||
eventHandler?.onInitialLoadDidRedirect(uri);
|
eventHandler?.onInitialLoadDidRedirect(uri);
|
||||||
break;
|
break;
|
||||||
case "onNavigationEvent":
|
|
||||||
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
|
|
||||||
call.arguments["navigationEvent"]);
|
|
||||||
eventHandler?.onNavigationEvent(navigationEvent);
|
|
||||||
break;
|
|
||||||
case "onRelationshipValidationResult":
|
|
||||||
final relation =
|
|
||||||
CustomTabsRelationType.fromNativeValue(call.arguments["relation"]);
|
|
||||||
final requestedOrigin = call.arguments["requestedOrigin"] != null
|
|
||||||
? WebUri(call.arguments["requestedOrigin"])
|
|
||||||
: null;
|
|
||||||
final bool result = call.arguments["result"];
|
|
||||||
eventHandler?.onRelationshipValidationResult(
|
|
||||||
relation, requestedOrigin, result);
|
|
||||||
break;
|
|
||||||
case "onWillOpenInBrowser":
|
case "onWillOpenInBrowser":
|
||||||
eventHandler?.onWillOpenInBrowser();
|
eventHandler?.onWillOpenInBrowser();
|
||||||
break;
|
break;
|
||||||
|
@ -119,14 +98,7 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
String url = call.arguments["url"];
|
String url = call.arguments["url"];
|
||||||
String title = call.arguments["title"];
|
String title = call.arguments["title"];
|
||||||
int id = call.arguments["id"].toInt();
|
int id = call.arguments["id"].toInt();
|
||||||
if (this._actionButton?.id == id) {
|
if (this._menuItems[id] != null) {
|
||||||
if (this._actionButton?.action != null) {
|
|
||||||
this._actionButton?.action!(url, title);
|
|
||||||
}
|
|
||||||
if (this._actionButton?.onClick != null) {
|
|
||||||
this._actionButton?.onClick!(WebUri(url), title);
|
|
||||||
}
|
|
||||||
} else if (this._menuItems[id] != null) {
|
|
||||||
if (this._menuItems[id]?.action != null) {
|
if (this._menuItems[id]?.action != null) {
|
||||||
this._menuItems[id]?.action!(url, title);
|
this._menuItems[id]?.action!(url, title);
|
||||||
}
|
}
|
||||||
|
@ -135,52 +107,6 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "onSecondaryItemActionPerform":
|
|
||||||
final clickableIDs = this._secondaryToolbar?.clickableIDs;
|
|
||||||
if (clickableIDs != null) {
|
|
||||||
WebUri? url = call.arguments["url"] != null
|
|
||||||
? WebUri(call.arguments["url"])
|
|
||||||
: null;
|
|
||||||
String name = call.arguments["name"];
|
|
||||||
for (final clickable in clickableIDs) {
|
|
||||||
var clickableFullname = clickable.id.name;
|
|
||||||
if (clickable.id.defType != null &&
|
|
||||||
!clickableFullname.contains("/")) {
|
|
||||||
clickableFullname = "${clickable.id.defType}/$clickableFullname";
|
|
||||||
}
|
|
||||||
if (clickable.id.defPackage != null &&
|
|
||||||
!clickableFullname.contains(":")) {
|
|
||||||
clickableFullname =
|
|
||||||
"${clickable.id.defPackage}:$clickableFullname";
|
|
||||||
}
|
|
||||||
if (clickableFullname == name) {
|
|
||||||
if (clickable.onClick != null) {
|
|
||||||
clickable.onClick!(url);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "onMessageChannelReady":
|
|
||||||
eventHandler?.onMessageChannelReady();
|
|
||||||
break;
|
|
||||||
case "onPostMessage":
|
|
||||||
final String message = call.arguments["message"];
|
|
||||||
eventHandler?.onPostMessage(message);
|
|
||||||
break;
|
|
||||||
case "onVerticalScrollEvent":
|
|
||||||
final bool isDirectionUp = call.arguments["isDirectionUp"];
|
|
||||||
eventHandler?.onVerticalScrollEvent(isDirectionUp);
|
|
||||||
break;
|
|
||||||
case "onGreatestScrollPercentageIncreased":
|
|
||||||
final int scrollPercentage = call.arguments["scrollPercentage"];
|
|
||||||
eventHandler?.onGreatestScrollPercentageIncreased(scrollPercentage);
|
|
||||||
break;
|
|
||||||
case "onSessionEnded":
|
|
||||||
final bool didUserInteract = call.arguments["didUserInteract"];
|
|
||||||
eventHandler?.onSessionEnded(didUserInteract);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw UnimplementedError("Unimplemented ${call.method} method");
|
throw UnimplementedError("Unimplemented ${call.method} method");
|
||||||
}
|
}
|
||||||
|
@ -227,86 +153,16 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
args.putIfAbsent('referrer', () => referrer?.toString());
|
||||||
args.putIfAbsent('settings', () => initialSettings);
|
args.putIfAbsent('settings', () => initialSettings);
|
||||||
args.putIfAbsent('actionButton', () => _actionButton?.toMap());
|
|
||||||
args.putIfAbsent('secondaryToolbar', () => _secondaryToolbar?.toMap());
|
|
||||||
args.putIfAbsent('menuItemList', () => menuItemList);
|
args.putIfAbsent('menuItemList', () => menuItemList);
|
||||||
await _staticChannel.invokeMethod('open', args);
|
await _staticChannel.invokeMethod('open', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> launchUrl({
|
|
||||||
required WebUri url,
|
|
||||||
Map<String, String>? headers,
|
|
||||||
List<WebUri>? otherLikelyURLs,
|
|
||||||
WebUri? referrer,
|
|
||||||
}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('url', () => url.toString());
|
|
||||||
args.putIfAbsent('headers', () => headers);
|
|
||||||
args.putIfAbsent('otherLikelyURLs',
|
|
||||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
|
||||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
|
||||||
await channel?.invokeMethod("launchUrl", args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> mayLaunchUrl(
|
|
||||||
{WebUri? url, List<WebUri>? otherLikelyURLs}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('url', () => url?.toString());
|
|
||||||
args.putIfAbsent('otherLikelyURLs',
|
|
||||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
|
||||||
return await channel?.invokeMethod<bool>("mayLaunchUrl", args) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> validateRelationship(
|
|
||||||
{required CustomTabsRelationType relation,
|
|
||||||
required WebUri origin}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('relation', () => relation.toNativeValue());
|
|
||||||
args.putIfAbsent('origin', () => origin.toString());
|
|
||||||
return await channel?.invokeMethod<bool>("validateRelationship", args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() async {
|
Future<void> close() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
await channel?.invokeMethod("close", args);
|
await channel?.invokeMethod("close", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void setActionButton(ChromeSafariBrowserActionButton actionButton) {
|
|
||||||
this._actionButton = actionButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateActionButton(
|
|
||||||
{required Uint8List icon, required String description}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('icon', () => icon);
|
|
||||||
args.putIfAbsent('description', () => description);
|
|
||||||
await channel?.invokeMethod("updateActionButton", args);
|
|
||||||
_actionButton?.icon = icon;
|
|
||||||
_actionButton?.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void setSecondaryToolbar(
|
|
||||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
|
|
||||||
this._secondaryToolbar = secondaryToolbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateSecondaryToolbar(
|
|
||||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('secondaryToolbar', () => secondaryToolbar.toMap());
|
|
||||||
await channel?.invokeMethod("updateSecondaryToolbar", args);
|
|
||||||
this._secondaryToolbar = secondaryToolbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
|
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
|
||||||
this._menuItems[menuItem.id] = menuItem;
|
this._menuItems[menuItem.id] = menuItem;
|
||||||
|
@ -319,34 +175,6 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> requestPostMessageChannel(
|
|
||||||
{required WebUri sourceOrigin, WebUri? targetOrigin}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("sourceOrigin", () => sourceOrigin.toString());
|
|
||||||
args.putIfAbsent("targetOrigin", () => targetOrigin.toString());
|
|
||||||
return await channel?.invokeMethod<bool>(
|
|
||||||
"requestPostMessageChannel", args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CustomTabsPostMessageResultType> postMessage(String message) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("message", () => message);
|
|
||||||
return CustomTabsPostMessageResultType.fromNativeValue(
|
|
||||||
await channel?.invokeMethod<int>("postMessage", args)) ??
|
|
||||||
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> isEngagementSignalsApiAvailable() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool>(
|
|
||||||
"isEngagementSignalsApiAvailable", args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> isAvailable() async {
|
Future<bool> isAvailable() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -354,22 +182,6 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||||
false;
|
false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<int> getMaxToolbarItems() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await _staticChannel.invokeMethod<int>("getMaxToolbarItems", args) ??
|
|
||||||
0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getPackageName(
|
|
||||||
{List<String>? packages, bool ignoreDefault = false}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("packages", () => packages);
|
|
||||||
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
|
|
||||||
return await _staticChannel.invokeMethod<String?>("getPackageName", args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> clearWebsiteData() async {
|
Future<void> clearWebsiteData() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -418,9 +418,6 @@ class IOSCookieManager extends PlatformCookieManager
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _shouldUseJavascript() async {
|
Future<bool> _shouldUseJavascript() async {
|
||||||
if (Util.isWeb) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Util.isIOS || Util.isMacOS) {
|
if (Util.isIOS || Util.isMacOS) {
|
||||||
final platformUtil = PlatformUtil.instance();
|
final platformUtil = PlatformUtil.instance();
|
||||||
final systemVersion = await platformUtil.getSystemVersion();
|
final systemVersion = await platformUtil.getSystemVersion();
|
||||||
|
|
|
@ -2595,63 +2595,6 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
|
||||||
false;
|
false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> startSafeBrowsing() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool>('startSafeBrowsing', args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> clearSslPreferences() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('clearSslPreferences', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> pause() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('pause', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> resume() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('resume', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> pageDown({required bool bottom}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("bottom", () => bottom);
|
|
||||||
return await channel?.invokeMethod<bool>('pageDown', args) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> pageUp({required bool top}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("top", () => top);
|
|
||||||
return await channel?.invokeMethod<bool>('pageUp', args) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> zoomIn() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool>('zoomIn', args) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> zoomOut() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<bool>('zoomOut', args) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> clearHistory() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod('clearHistory', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> reloadFromOrigin() async {
|
Future<void> reloadFromOrigin() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -2756,12 +2699,6 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
|
||||||
await channel?.invokeMethod('loadSimulatedRequest', args);
|
await channel?.invokeMethod('loadSimulatedRequest', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getIFrameId() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<String?>('getIFrameId', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> getDefaultUserAgent() async {
|
Future<String> getDefaultUserAgent() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -2770,73 +2707,6 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> clearClientCertPreferences() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await _staticChannel.invokeMethod('clearClientCertPreferences', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<WebUri?> getSafeBrowsingPrivacyPolicyUrl() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
String? url = await _staticChannel.invokeMethod(
|
|
||||||
'getSafeBrowsingPrivacyPolicyUrl', args);
|
|
||||||
return url != null ? WebUri(url) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@Deprecated("Use setSafeBrowsingAllowlist instead")
|
|
||||||
Future<bool> setSafeBrowsingWhitelist({required List<String> hosts}) async {
|
|
||||||
return await setSafeBrowsingAllowlist(hosts: hosts);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> setSafeBrowsingAllowlist({required List<String> hosts}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('hosts', () => hosts);
|
|
||||||
return await _staticChannel.invokeMethod<bool>(
|
|
||||||
'setSafeBrowsingAllowlist', args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<WebViewPackageInfo?> getCurrentWebViewPackage() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
Map<String, dynamic>? packageInfo =
|
|
||||||
(await _staticChannel.invokeMethod('getCurrentWebViewPackage', args))
|
|
||||||
?.cast<String, dynamic>();
|
|
||||||
return WebViewPackageInfo.fromMap(packageInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setWebContentsDebuggingEnabled(bool debuggingEnabled) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('debuggingEnabled', () => debuggingEnabled);
|
|
||||||
return await _staticChannel.invokeMethod(
|
|
||||||
'setWebContentsDebuggingEnabled', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getVariationsHeader() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await _staticChannel.invokeMethod<String?>(
|
|
||||||
'getVariationsHeader', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> isMultiProcessEnabled() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await _staticChannel.invokeMethod<bool>(
|
|
||||||
'isMultiProcessEnabled', args) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> disableWebView() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await _staticChannel.invokeMethod('disableWebView', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> handlesURLScheme(String urlScheme) async {
|
Future<bool> handlesURLScheme(String urlScheme) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -55,18 +55,6 @@ class IOSPrintJobController extends PlatformPrintJobController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> cancel() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('cancel', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> restart() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('restart', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> dismiss({bool animated: true}) async {
|
Future<void> dismiss({bool animated: true}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
|
|
@ -110,43 +110,6 @@ class IOSPullToRefreshController extends PlatformPullToRefreshController
|
||||||
await channel?.invokeMethod('setBackgroundColor', args);
|
await channel?.invokeMethod('setBackgroundColor', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setDistanceToTriggerSync(int distanceToTriggerSync) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('distanceToTriggerSync', () => distanceToTriggerSync);
|
|
||||||
await channel?.invokeMethod('setDistanceToTriggerSync', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setSlingshotDistance(int slingshotDistance) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('slingshotDistance', () => slingshotDistance);
|
|
||||||
await channel?.invokeMethod('setSlingshotDistance', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<int> getDefaultSlingshotDistance() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
return await channel?.invokeMethod<int>(
|
|
||||||
'getDefaultSlingshotDistance', args) ??
|
|
||||||
0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Use setIndicatorSize instead")
|
|
||||||
@override
|
|
||||||
Future<void> setSize(AndroidPullToRefreshSize size) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('size', () => size.toNativeValue());
|
|
||||||
await channel?.invokeMethod('setSize', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setIndicatorSize(PullToRefreshSize size) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent('size', () => size.toNativeValue());
|
|
||||||
await channel?.invokeMethod('setSize', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Use setStyledTitle instead")
|
@Deprecated("Use setStyledTitle instead")
|
||||||
@override
|
@override
|
||||||
Future<void> setAttributedTitle(IOSNSAttributedString attributedTitle) async {
|
Future<void> setAttributedTitle(IOSNSAttributedString attributedTitle) async {
|
||||||
|
|
|
@ -58,53 +58,6 @@ class IOSWebStorageManager extends PlatformWebStorageManager
|
||||||
|
|
||||||
Future<dynamic> _handleMethod(MethodCall call) async {}
|
Future<dynamic> _handleMethod(MethodCall call) async {}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<WebStorageOrigin>> getOrigins() async {
|
|
||||||
List<WebStorageOrigin> originsList = [];
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
List<Map<dynamic, dynamic>> origins =
|
|
||||||
(await channel?.invokeMethod<List>('getOrigins', args))
|
|
||||||
?.cast<Map<dynamic, dynamic>>() ??
|
|
||||||
[];
|
|
||||||
|
|
||||||
for (var origin in origins) {
|
|
||||||
originsList.add(WebStorageOrigin(
|
|
||||||
origin: origin["origin"],
|
|
||||||
quota: origin["quota"],
|
|
||||||
usage: origin["usage"]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return originsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteAllData() async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
await channel?.invokeMethod('deleteAllData', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteOrigin({required String origin}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("origin", () => origin);
|
|
||||||
await channel?.invokeMethod('deleteOrigin', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<int> getQuotaForOrigin({required String origin}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("origin", () => origin);
|
|
||||||
return await channel?.invokeMethod<int>('getQuotaForOrigin', args) ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<int> getUsageForOrigin({required String origin}) async {
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
|
||||||
args.putIfAbsent("origin", () => origin);
|
|
||||||
return await channel?.invokeMethod<int>('getUsageForOrigin', args) ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<WebsiteDataRecord>> fetchDataRecords(
|
Future<List<WebsiteDataRecord>> fetchDataRecords(
|
||||||
{required Set<WebsiteDataType> dataTypes}) async {
|
{required Set<WebsiteDataType> dataTypes}) async {
|
||||||
|
|
|
@ -125,6 +125,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<int?> length() {
|
Future<int?> length() {
|
||||||
|
@ -140,6 +141,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<void> setItem({required String key, required dynamic value}) {
|
Future<void> setItem({required String key, required dynamic value}) {
|
||||||
|
@ -155,6 +157,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<dynamic> getItem({required String key}) {
|
Future<dynamic> getItem({required String key}) {
|
||||||
|
@ -170,6 +173,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<void> removeItem({required String key}) {
|
Future<void> removeItem({required String key}) {
|
||||||
|
@ -185,6 +189,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<List<WebStorageItem>> getItems() {
|
Future<List<WebStorageItem>> getItems() {
|
||||||
|
@ -200,6 +205,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<void> clear() {
|
Future<void> clear() {
|
||||||
|
@ -216,6 +222,7 @@ abstract class PlatformStorage implements Disposable {
|
||||||
///**Officially Supported Platforms/Implementations**:
|
///**Officially Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
///- MacOS
|
||||||
///- Web
|
///- Web
|
||||||
///{@endtemplate}
|
///{@endtemplate}
|
||||||
Future<String> key({required int index}) {
|
Future<String> key({required int index}) {
|
||||||
|
|
Loading…
Reference in New Issue