From b2a0a968987a468386b9b97255df79e6ff859a83 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Tue, 12 Dec 2023 00:40:25 +0100 Subject: [PATCH] Added InAppWebViewController.clearFormData Android-specific method, Added InAppWebViewController.clearAllCache static method, Added CookieManager.removeSessionCookies Android-specific method, Deprecated InAppWebViewController.clearCache and InAppWebViewSettings.clearCache, Deprecated InAppWebViewSettings.clearSessionCache, Updated CookieManager methods return value --- flutter_inappwebview/CHANGELOG.md | 8 +- .../cookie_manager/set_get_delete.dart | 20 +- .../in_app_webview/clear_cache.dart | 28 +- .../lib/src/cookie_manager.dart | 9 +- .../in_app_webview_controller.dart | 9 + flutter_inappwebview_android/CHANGELOG.md | 3 + .../MyCookieManager.java | 62 +++- .../webview/InAppWebViewManager.java | 38 ++- .../webview/WebViewChannelDelegate.java | 9 +- .../WebViewChannelDelegateMethods.java | 7 +- .../webview/in_app_webview/InAppWebView.java | 8 + .../in_app_webview/InAppWebViewSettings.java | 8 + .../lib/src/cookie_manager.dart | 19 +- .../in_app_webview_controller.dart | 14 + flutter_inappwebview_ios/CHANGELOG.md | 1 + .../Classes/InAppWebView/InAppWebView.swift | 2 +- .../InAppWebView/InAppWebViewManager.swift | 23 ++ .../InAppWebView/InAppWebViewSettings.swift | 1 + .../WebViewChannelDelegateMethods.swift | 1 + .../lib/src/cookie_manager.dart | 16 +- .../in_app_webview_controller.dart | 8 + flutter_inappwebview_macos/CHANGELOG.md | 1 + .../lib/src/cookie_manager.dart | 16 +- .../in_app_webview_controller.dart | 8 + .../Classes/InAppWebView/InAppWebView.swift | 1 + .../InAppWebView/InAppWebViewManager.swift | 18 ++ .../InAppWebView/InAppWebViewSettings.swift | 1 + .../WebViewChannelDelegateMethods.swift | 1 + .../CHANGELOG.md | 5 +- .../platform_chrome_safari_browser.dart | 2 +- .../platform_in_app_browser.dart | 16 +- .../in_app_webview_settings.dart | 6 +- .../in_app_webview_settings.g.dart | 14 +- .../platform_inappwebview_controller.dart | 279 ++++++++++-------- .../lib/src/platform_cookie_manager.dart | 28 +- flutter_inappwebview_web/CHANGELOG.md | 1 + .../lib/src/cookie_manager.dart | 8 +- 37 files changed, 473 insertions(+), 226 deletions(-) diff --git a/flutter_inappwebview/CHANGELOG.md b/flutter_inappwebview/CHANGELOG.md index 0391dbad..8a28555a 100755 --- a/flutter_inappwebview/CHANGELOG.md +++ b/flutter_inappwebview/CHANGELOG.md @@ -1,8 +1,14 @@ ## 6.0.0-beta.32 - Updated minimum platform interface and implementation versions -- Updated `useShouldInterceptAjaxRequest` automatic infer logic - Added `InAppWebViewSettings.interceptOnlyAsyncAjaxRequests` [#1905](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1905) +- Added `InAppWebViewController.clearFormData` Android-specific method +- Added `InAppWebViewController.clearAllCache` static method +- Added `CookieManager.removeSessionCookies` Android-specific method +- Deprecated `InAppWebViewController.clearCache` and `InAppWebViewSettings.clearCache`. Use `InAppWebViewController.clearAllCache` static method instead +- Deprecated `InAppWebViewSettings.clearSessionCache`. Use `CookieManager.removeSessionCookies` method instead +- Updated `useShouldInterceptAjaxRequest` automatic infer logic +- Updated `CookieManager` methods return value - Fixed "iOS crash at public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)" [#1912](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1912) - Fixed "iOS Fatal Crash" [#1894](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1894) - Fixed "getFavicons: _TypeError: type '_Map' is not a subtype of type 'Iterable'" [#1897](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1897) diff --git a/flutter_inappwebview/example/integration_test/cookie_manager/set_get_delete.dart b/flutter_inappwebview/example/integration_test/cookie_manager/set_get_delete.dart index 5d9dd816..4c6d04d2 100644 --- a/flutter_inappwebview/example/integration_test/cookie_manager/set_get_delete.dart +++ b/flutter_inappwebview/example/integration_test/cookie_manager/set_get_delete.dart @@ -49,6 +49,12 @@ void setGetDelete() { final url = WebUri(await pageLoaded.future); + if (defaultTargetPlatform == TargetPlatform.android) { + await cookieManager.setCookie( + url: url, name: "myCookie", value: "myValue"); + expect(await cookieManager.removeSessionCookies(), isTrue); + } + await cookieManager.setCookie(url: url, name: "myCookie", value: "myValue"); List cookies = await cookieManager.getCookies(url: url); expect(cookies, isNotEmpty); @@ -56,12 +62,20 @@ void setGetDelete() { Cookie? cookie = await cookieManager.getCookie(url: url, name: "myCookie"); expect(cookie?.value.toString(), "myValue"); - await cookieManager.deleteCookie(url: url, name: "myCookie"); + expect( + await cookieManager.deleteCookie(url: url, name: "myCookie"), isTrue); cookie = await cookieManager.getCookie(url: url, name: "myCookie"); expect(cookie, isNull); - await cookieManager.deleteCookies( - url: url, domain: ".${TEST_CROSS_PLATFORM_URL_1.host}"); + expect( + await cookieManager.deleteCookies( + url: url, domain: ".${TEST_CROSS_PLATFORM_URL_1.host}"), + isTrue); + cookies = await cookieManager.getCookies(url: url); + expect(cookies, isEmpty); + + await cookieManager.setCookie(url: url, name: "myCookie", value: "myValue"); + expect(await cookieManager.deleteAllCookies(), isTrue); cookies = await cookieManager.getCookies(url: url); expect(cookies, isEmpty); diff --git a/flutter_inappwebview/example/integration_test/in_app_webview/clear_cache.dart b/flutter_inappwebview/example/integration_test/in_app_webview/clear_cache.dart index 8c4ece5b..76116575 100644 --- a/flutter_inappwebview/example/integration_test/in_app_webview/clear_cache.dart +++ b/flutter_inappwebview/example/integration_test/in_app_webview/clear_cache.dart @@ -9,29 +9,9 @@ void clearCache() { TargetPlatform.macOS, ].contains(defaultTargetPlatform); - skippableTestWidgets('clearCache', (WidgetTester tester) async { - final Completer controllerCompleter = - Completer(); - final Completer pageLoaded = Completer(); - - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: InAppWebView( - key: GlobalKey(), - initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1), - onWebViewCreated: (controller) { - controllerCompleter.complete(controller); - }, - onLoadStop: (controller, url) { - pageLoaded.complete(); - }, - ), - ), - ); - - final InAppWebViewController controller = await controllerCompleter.future; - await pageLoaded.future; - await expectLater(controller.clearCache(), completes); + skippableTestWidgets('clearAllCache', (WidgetTester tester) async { + await expectLater( + InAppWebViewController.clearAllCache(includeDiskFiles: true), + completes); }, skip: shouldSkip); } diff --git a/flutter_inappwebview/lib/src/cookie_manager.dart b/flutter_inappwebview/lib/src/cookie_manager.dart index 843aa0b4..19afa277 100755 --- a/flutter_inappwebview/lib/src/cookie_manager.dart +++ b/flutter_inappwebview/lib/src/cookie_manager.dart @@ -93,7 +93,7 @@ class CookieManager { webViewController: webViewController?.platform); ///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager.deleteCookie} - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -110,7 +110,7 @@ class CookieManager { webViewController: webViewController?.platform); ///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager.deleteCookies} - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -125,10 +125,13 @@ class CookieManager { webViewController: webViewController?.platform); ///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager.deleteAllCookies} - Future deleteAllCookies() => platform.deleteAllCookies(); + Future deleteAllCookies() => platform.deleteAllCookies(); ///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager.getAllCookies} Future> getAllCookies() => platform.getAllCookies(); + + ///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager.removeSessionCookies} + Future removeSessionCookies() => platform.removeSessionCookies(); } ///Class that contains only iOS-specific methods of [CookieManager]. diff --git a/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart index bca68493..ee98e38d 100644 --- a/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart @@ -206,6 +206,7 @@ class InAppWebViewController { platform.getCopyBackForwardList(); ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearCache} + @Deprecated("Use InAppWebViewController.clearAllCache instead") Future clearCache() => platform.clearCache(); ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.findAllAsync} @@ -457,6 +458,9 @@ class InAppWebViewController { ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.isInFullscreen} Future isInFullscreen() => platform.isInFullscreen(); + ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearFormData} + Future clearFormData() => platform.clearFormData(); + ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getCameraCaptureState} Future getCameraCaptureState() => platform.getCameraCaptureState(); @@ -535,6 +539,11 @@ class InAppWebViewController { static Future disposeKeepAlive(InAppWebViewKeepAlive keepAlive) => PlatformInAppWebViewController.static().disposeKeepAlive(keepAlive); + ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearAllCache} + static Future clearAllCache({bool includeDiskFiles = true}) => + PlatformInAppWebViewController.static() + .clearAllCache(includeDiskFiles: includeDiskFiles); + ///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.tRexRunnerHtml} static Future get tRexRunnerHtml => PlatformInAppWebViewController.static().tRexRunnerHtml; diff --git a/flutter_inappwebview_android/CHANGELOG.md b/flutter_inappwebview_android/CHANGELOG.md index 941cf434..185da823 100644 --- a/flutter_inappwebview_android/CHANGELOG.md +++ b/flutter_inappwebview_android/CHANGELOG.md @@ -1,7 +1,10 @@ ## 1.0.8 - Implemented `InAppWebViewSettings.interceptOnlyAsyncAjaxRequests` +- Implemented `PlatformInAppWebViewController.clearFormData` method +- Implemented `PlatformCookieManager.removeSessionCookies` method - Updated `useShouldInterceptAjaxRequest` automatic infer logic +- Updated `CookieManager` methods return value ## 1.0.7 diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/MyCookieManager.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/MyCookieManager.java index 1a775018..ff4247e7 100755 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/MyCookieManager.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/MyCookieManager.java @@ -100,6 +100,9 @@ public class MyCookieManager extends ChannelDelegateImpl { case "deleteAllCookies": deleteAllCookies(result); break; + case "removeSessionCookies": + removeSessionCookies(result); + break; default: result.notImplemented(); } @@ -151,7 +154,10 @@ public class MyCookieManager extends ChannelDelegateImpl { String sameSite, final MethodChannel.Result result) { cookieManager = getCookieManager(); - if (cookieManager == null) return; + if (cookieManager == null) { + result.success(false); + return; + } String cookieValue = name + "=" + value + "; Path=" + path; @@ -188,9 +194,9 @@ public class MyCookieManager extends ChannelDelegateImpl { CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(plugin.applicationContext); cookieSyncMngr.startSync(); cookieManager.setCookie(url, cookieValue); - result.success(true); cookieSyncMngr.stopSync(); cookieSyncMngr.sync(); + result.success(true); } else { cookieManager.setCookie(url, cookieValue); result.success(true); @@ -281,7 +287,10 @@ public class MyCookieManager extends ChannelDelegateImpl { public void deleteCookie(String url, String name, String domain, String path, final MethodChannel.Result result) { cookieManager = getCookieManager(); - if (cookieManager == null) return; + if (cookieManager == null) { + result.success(false); + return; + } String cookieValue = name + "=; Path=" + path + "; Max-Age=-1"; @@ -294,7 +303,7 @@ public class MyCookieManager extends ChannelDelegateImpl { cookieManager.setCookie(url, cookieValue, new ValueCallback() { @Override public void onReceiveValue(Boolean successful) { - result.success(true); + result.success(successful); } }); cookieManager.flush(); @@ -303,9 +312,9 @@ public class MyCookieManager extends ChannelDelegateImpl { CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(plugin.applicationContext); cookieSyncMngr.startSync(); cookieManager.setCookie(url, cookieValue); - result.success(true); cookieSyncMngr.stopSync(); cookieSyncMngr.sync(); + result.success(true); } else { cookieManager.setCookie(url, cookieValue); result.success(true); @@ -314,7 +323,10 @@ public class MyCookieManager extends ChannelDelegateImpl { public void deleteCookies(String url, String domain, String path, final MethodChannel.Result result) { cookieManager = getCookieManager(); - if (cookieManager == null) return; + if (cookieManager == null) { + result.success(false); + return; + } CookieSyncManager cookieSyncMngr = null; @@ -355,13 +367,16 @@ public class MyCookieManager extends ChannelDelegateImpl { public void deleteAllCookies(final MethodChannel.Result result) { cookieManager = getCookieManager(); - if (cookieManager == null) return; + if (cookieManager == null) { + result.success(false); + return; + } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cookieManager.removeAllCookies(new ValueCallback() { @Override public void onReceiveValue(Boolean successful) { - result.success(true); + result.success(successful); } }); cookieManager.flush(); @@ -370,15 +385,44 @@ public class MyCookieManager extends ChannelDelegateImpl { CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(plugin.applicationContext); cookieSyncMngr.startSync(); cookieManager.removeAllCookie(); - result.success(true); cookieSyncMngr.stopSync(); cookieSyncMngr.sync(); + result.success(true); } else { cookieManager.removeAllCookie(); result.success(true); } } + public void removeSessionCookies(final MethodChannel.Result result) { + cookieManager = getCookieManager(); + if (cookieManager == null) { + result.success(false); + return; + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + cookieManager.removeSessionCookies(new ValueCallback() { + @Override + public void onReceiveValue(Boolean successful) { + result.success(successful); + } + }); + cookieManager.flush(); + } + else if (plugin != null) { + CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(plugin.applicationContext); + cookieSyncMngr.startSync(); + cookieManager.removeSessionCookie(); + cookieSyncMngr.stopSync(); + cookieSyncMngr.sync(); + result.success(true); + } else { + cookieManager.removeSessionCookie(); + result.success(true); + } + } + public static String getCookieExpirationDate(Long timestamp) { final SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/InAppWebViewManager.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/InAppWebViewManager.java index 98280fc5..623354ae 100755 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/InAppWebViewManager.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/InAppWebViewManager.java @@ -96,15 +96,17 @@ public class InAppWebViewManager extends ChannelDelegateImpl { result.success(false); break; case "getCurrentWebViewPackage": - Context context = null; - if (plugin != null) { - context = plugin.activity; - if (context == null) { - context = plugin.applicationContext; + { + Context context = null; + if (plugin != null) { + context = plugin.activity; + if (context == null) { + context = plugin.applicationContext; + } } + PackageInfo packageInfo = context != null ? WebViewCompat.getCurrentWebViewPackage(context) : null; + result.success(packageInfo != null ? convertWebViewPackageToMap(packageInfo) : null); } - PackageInfo packageInfo = context != null ? WebViewCompat.getCurrentWebViewPackage(context) : null; - result.success(packageInfo != null ? convertWebViewPackageToMap(packageInfo) : null); break; case "setWebContentsDebuggingEnabled": { @@ -144,6 +146,22 @@ public class InAppWebViewManager extends ChannelDelegateImpl { } result.success(true); break; + case "clearAllCache": + { + Context context = null; + if (plugin != null) { + context = plugin.activity; + if (context == null) { + context = plugin.applicationContext; + } + if (context != null) { + boolean includeDiskFiles = (boolean) call.argument("includeDiskFiles"); + clearAllCache(context, includeDiskFiles); + } + } + } + result.success(true); + break; default: result.notImplemented(); } @@ -178,6 +196,12 @@ public class InAppWebViewManager extends ChannelDelegateImpl { } } + public void clearAllCache(@NonNull Context context, boolean includeDiskFiles) { + WebView tempWebView = new WebView(context); + tempWebView.clearCache(includeDiskFiles); + tempWebView.destroy(); + } + @Override public void dispose() { super.dispose(); diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegate.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegate.java index cb1baacd..5f87b93c 100644 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegate.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegate.java @@ -66,9 +66,9 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl { static final String LOG_TAG = "WebViewChannelDelegate"; @Nullable - private InAppWebViewInterface webView; + private InAppWebView webView; - public WebViewChannelDelegate(@NonNull InAppWebViewInterface webView, @NonNull MethodChannel channel) { + public WebViewChannelDelegate(@NonNull InAppWebView webView, @NonNull MethodChannel channel) { super(channel); this.webView = webView; } @@ -670,6 +670,11 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl { result.success(false); } break; + case clearFormData: + if (webView != null) { + webView.clearFormData(); + } + result.success(true); } } diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegateMethods.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegateMethods.java index 049a6a59..3c6d6ae1 100644 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegateMethods.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/WebViewChannelDelegateMethods.java @@ -30,6 +30,10 @@ public enum WebViewChannelDelegateMethods { isHidden, getCopyBackForwardList, startSafeBrowsing, + /** + * @deprecated + */ + @Deprecated clearCache, clearSslPreferences, /** @@ -77,5 +81,6 @@ public enum WebViewChannelDelegateMethods { addWebMessageListener, canScrollVertically, canScrollHorizontally, - isInFullscreen + isInFullscreen, + clearFormData } diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebView.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebView.java index 27f4a25f..bde634bb 100755 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebView.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebView.java @@ -672,6 +672,10 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie return isLoading; } + /** + * @deprecated + */ + @Deprecated private void clearCookies() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().removeAllCookies(new ValueCallback() { @@ -685,6 +689,10 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie } } + /** + * @deprecated + */ + @Deprecated public void clearAllCache() { clearCache(true); clearCookies(); diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebViewSettings.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebViewSettings.java index 3c0feaef..6bf17f60 100755 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebViewSettings.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/webview/in_app_webview/InAppWebViewSettings.java @@ -31,6 +31,10 @@ public class InAppWebViewSettings implements ISettings { public Boolean useShouldOverrideUrlLoading = false; public Boolean useOnLoadResource = false; public Boolean useOnDownloadStart = false; + /** + * @deprecated + */ + @Deprecated public Boolean clearCache = false; public String userAgent = ""; public String applicationNameForUserAgent = ""; @@ -57,6 +61,10 @@ public class InAppWebViewSettings implements ISettings { public Boolean allowUniversalAccessFromFileURLs = false; public Boolean allowBackgroundAudioPlaying = false; public Integer textZoom = 100; + /** + * @deprecated + */ + @Deprecated public Boolean clearSessionCache = false; public Boolean builtInZoomControls = true; public Boolean displayZoomControls = false; diff --git a/flutter_inappwebview_android/lib/src/cookie_manager.dart b/flutter_inappwebview_android/lib/src/cookie_manager.dart index 1499b6e7..c0e2fba5 100755 --- a/flutter_inappwebview_android/lib/src/cookie_manager.dart +++ b/flutter_inappwebview_android/lib/src/cookie_manager.dart @@ -160,7 +160,7 @@ class AndroidCookieManager extends PlatformCookieManager } @override - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -176,11 +176,11 @@ class AndroidCookieManager extends PlatformCookieManager args.putIfAbsent('name', () => name); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookie', args); + return await channel?.invokeMethod('deleteCookie', args) ?? false; } @override - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -193,13 +193,20 @@ class AndroidCookieManager extends PlatformCookieManager args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookies', args); + return await channel?.invokeMethod('deleteCookies', args) ?? false; } @override - Future deleteAllCookies() async { + Future deleteAllCookies() async { Map args = {}; - await channel?.invokeMethod('deleteAllCookies', args); + return await channel?.invokeMethod('deleteAllCookies', args) ?? false; + } + + @override + Future removeSessionCookies() async { + Map args = {}; + return await channel?.invokeMethod('removeSessionCookies', args) ?? + false; } @override diff --git a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart index 5bf7a958..9bb24a73 100644 --- a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart @@ -2067,6 +2067,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController } @override + @Deprecated("Use InAppWebViewController.clearAllCache instead") Future clearCache() async { Map args = {}; await channel?.invokeMethod('clearCache', args); @@ -2641,6 +2642,12 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('isInFullscreen', args) ?? false; } + @override + Future clearFormData() async { + Map args = {}; + return await channel?.invokeMethod('clearFormData', args); + } + @override Future getDefaultUserAgent() async { Map args = {}; @@ -2724,6 +2731,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController _keepAliveMap[keepAlive] = null; } + @override + Future clearAllCache({bool includeDiskFiles = true}) async { + Map args = {}; + args.putIfAbsent('includeDiskFiles', () => includeDiskFiles); + await _staticChannel.invokeMethod('clearAllCache', args); + } + @override Future get tRexRunnerHtml async => await rootBundle.loadString( 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html'); diff --git a/flutter_inappwebview_ios/CHANGELOG.md b/flutter_inappwebview_ios/CHANGELOG.md index 014bb3e5..451fcaac 100644 --- a/flutter_inappwebview_ios/CHANGELOG.md +++ b/flutter_inappwebview_ios/CHANGELOG.md @@ -2,6 +2,7 @@ - Implemented `InAppWebViewSettings.interceptOnlyAsyncAjaxRequests` - Updated `useShouldInterceptAjaxRequest` automatic infer logic +- Updated `CookieManager` methods return value - Fixed "iOS crash at public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)" [#1912](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1912) ## 1.0.8 diff --git a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift index f2e7e1b5..c4390995 100755 --- a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift +++ b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift @@ -1346,9 +1346,9 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, } } + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") public func clearCache() { if #available(iOS 9.0, *) { - //let websiteDataTypes = NSSet(array: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache]) let date = NSDate(timeIntervalSince1970: 0) WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: date as Date, completionHandler:{ }) } else { diff --git a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewManager.swift b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewManager.swift index b88e6b5e..079f1303 100755 --- a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewManager.swift +++ b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewManager.swift @@ -45,6 +45,11 @@ public class InAppWebViewManager: ChannelDelegate { disposeKeepAlive(keepAliveId: keepAliveId) result(true) break + case "clearAllCache": + let includeDiskFiles = arguments!["includeDiskFiles"] as! Bool + clearAllCache(includeDiskFiles: includeDiskFiles, completionHandler: { + result(true) + }) default: result(FlutterMethodNotImplemented) break @@ -84,6 +89,24 @@ public class InAppWebViewManager: ChannelDelegate { } } + public func clearAllCache(includeDiskFiles: Bool, completionHandler: @escaping () -> Void) { + if #available(iOS 9.0, *) { + var websiteDataTypes = Set([WKWebsiteDataTypeMemoryCache]) + if includeDiskFiles { + websiteDataTypes.insert(WKWebsiteDataTypeDiskCache) + if #available(iOS 11.3, *) { + websiteDataTypes.insert(WKWebsiteDataTypeFetchCache) + } + websiteDataTypes.insert(WKWebsiteDataTypeOfflineWebApplicationCache) + } + let date = NSDate(timeIntervalSince1970: 0) + WKWebsiteDataStore.default().removeData(ofTypes: websiteDataTypes, modifiedSince: date as Date, completionHandler: completionHandler) + } else { + URLCache.shared.removeAllCachedResponses() + completionHandler() + } + } + public override func dispose() { super.dispose() let keepAliveWebViewValues = keepAliveWebViews.values diff --git a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewSettings.swift b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewSettings.swift index c668fc17..52ede006 100755 --- a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewSettings.swift +++ b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebViewSettings.swift @@ -14,6 +14,7 @@ public class InAppWebViewSettings: ISettings { var useShouldOverrideUrlLoading = false var useOnLoadResource = false var useOnDownloadStart = false + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") var clearCache = false var userAgent = "" var applicationNameForUserAgent = "" diff --git a/flutter_inappwebview_ios/ios/Classes/InAppWebView/WebViewChannelDelegateMethods.swift b/flutter_inappwebview_ios/ios/Classes/InAppWebView/WebViewChannelDelegateMethods.swift index d9e99ad1..899cd769 100644 --- a/flutter_inappwebview_ios/ios/Classes/InAppWebView/WebViewChannelDelegateMethods.swift +++ b/flutter_inappwebview_ios/ios/Classes/InAppWebView/WebViewChannelDelegateMethods.swift @@ -42,6 +42,7 @@ public enum WebViewChannelDelegateMethods: String { case findNext = "findNext" @available(*, deprecated, message: "Use FindInteractionController.clearMatches instead.") case clearMatches = "clearMatches" + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") case clearCache = "clearCache" case scrollTo = "scrollTo" case scrollBy = "scrollBy" diff --git a/flutter_inappwebview_ios/lib/src/cookie_manager.dart b/flutter_inappwebview_ios/lib/src/cookie_manager.dart index 12869d00..e640c9f0 100755 --- a/flutter_inappwebview_ios/lib/src/cookie_manager.dart +++ b/flutter_inappwebview_ios/lib/src/cookie_manager.dart @@ -305,7 +305,7 @@ class IOSCookieManager extends PlatformCookieManager with ChannelController { } @override - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -327,7 +327,7 @@ class IOSCookieManager extends PlatformCookieManager with ChannelController { domain: domain, maxAge: -1, webViewController: webViewController); - return; + return true; } Map args = {}; @@ -335,11 +335,11 @@ class IOSCookieManager extends PlatformCookieManager with ChannelController { args.putIfAbsent('name', () => name); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookie', args); + return await channel?.invokeMethod('deleteCookie', args) ?? false; } @override - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -363,20 +363,20 @@ class IOSCookieManager extends PlatformCookieManager with ChannelController { maxAge: -1, webViewController: webViewController); } - return; + return true; } Map args = {}; args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookies', args); + return await channel?.invokeMethod('deleteCookies', args) ?? false; } @override - Future deleteAllCookies() async { + Future deleteAllCookies() async { Map args = {}; - await channel?.invokeMethod('deleteAllCookies', args); + return await channel?.invokeMethod('deleteAllCookies', args) ?? false; } @override diff --git a/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart index 6447b15f..b1232a7c 100644 --- a/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart @@ -2056,6 +2056,7 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController } @override + @Deprecated("Use InAppWebViewController.clearAllCache instead") Future clearCache() async { Map args = {}; await channel?.invokeMethod('clearCache', args); @@ -2704,6 +2705,13 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController _keepAliveMap[keepAlive] = null; } + @override + Future clearAllCache({bool includeDiskFiles = true}) async { + Map args = {}; + args.putIfAbsent('includeDiskFiles', () => includeDiskFiles); + await _staticChannel.invokeMethod('clearAllCache', args); + } + @override Future get tRexRunnerHtml async => await rootBundle.loadString( 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html'); diff --git a/flutter_inappwebview_macos/CHANGELOG.md b/flutter_inappwebview_macos/CHANGELOG.md index dd346528..95339a67 100644 --- a/flutter_inappwebview_macos/CHANGELOG.md +++ b/flutter_inappwebview_macos/CHANGELOG.md @@ -2,6 +2,7 @@ - Implemented `InAppWebViewSettings.interceptOnlyAsyncAjaxRequests` - Updated `useShouldInterceptAjaxRequest` automatic infer logic +- Updated `CookieManager` methods return value - Fixed "iOS crash at public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)" [#1912](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1912) ## 1.0.6 diff --git a/flutter_inappwebview_macos/lib/src/cookie_manager.dart b/flutter_inappwebview_macos/lib/src/cookie_manager.dart index dfa1e8a6..bf9d5a9b 100755 --- a/flutter_inappwebview_macos/lib/src/cookie_manager.dart +++ b/flutter_inappwebview_macos/lib/src/cookie_manager.dart @@ -305,7 +305,7 @@ class MacOSCookieManager extends PlatformCookieManager with ChannelController { } @override - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -327,7 +327,7 @@ class MacOSCookieManager extends PlatformCookieManager with ChannelController { domain: domain, maxAge: -1, webViewController: webViewController); - return; + return true; } Map args = {}; @@ -335,11 +335,11 @@ class MacOSCookieManager extends PlatformCookieManager with ChannelController { args.putIfAbsent('name', () => name); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookie', args); + return await channel?.invokeMethod('deleteCookie', args) ?? false; } @override - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -363,20 +363,20 @@ class MacOSCookieManager extends PlatformCookieManager with ChannelController { maxAge: -1, webViewController: webViewController); } - return; + return true; } Map args = {}; args.putIfAbsent('url', () => url.toString()); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - await channel?.invokeMethod('deleteCookies', args); + return await channel?.invokeMethod('deleteCookies', args) ?? false; } @override - Future deleteAllCookies() async { + Future deleteAllCookies() async { Map args = {}; - await channel?.invokeMethod('deleteAllCookies', args); + return await channel?.invokeMethod('deleteAllCookies', args) ?? false; } @override diff --git a/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart index ef49f5cf..40ea29ff 100644 --- a/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart @@ -2057,6 +2057,7 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController } @override + @Deprecated("Use InAppWebViewController.clearAllCache instead") Future clearCache() async { Map args = {}; await channel?.invokeMethod('clearCache', args); @@ -2640,6 +2641,13 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController _keepAliveMap[keepAlive] = null; } + @override + Future clearAllCache({bool includeDiskFiles = true}) async { + Map args = {}; + args.putIfAbsent('includeDiskFiles', () => includeDiskFiles); + await _staticChannel.invokeMethod('clearAllCache', args); + } + @override Future get tRexRunnerHtml async => await rootBundle.loadString( 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html'); diff --git a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift index 304655da..154dd55c 100755 --- a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift +++ b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift @@ -796,6 +796,7 @@ public class InAppWebView: WKWebView, WKUIDelegate, } } + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") public func clearCache() { let date = NSDate(timeIntervalSince1970: 0) WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: date as Date, completionHandler:{ }) diff --git a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewManager.swift b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewManager.swift index 692ba193..a9ebe4e4 100755 --- a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewManager.swift +++ b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewManager.swift @@ -46,6 +46,11 @@ public class InAppWebViewManager: ChannelDelegate { disposeKeepAlive(keepAliveId: keepAliveId) result(true) break + case "clearAllCache": + let includeDiskFiles = arguments!["includeDiskFiles"] as! Bool + clearAllCache(includeDiskFiles: includeDiskFiles, completionHandler: { + result(true) + }) default: result(FlutterMethodNotImplemented) break @@ -85,6 +90,19 @@ public class InAppWebViewManager: ChannelDelegate { } } + public func clearAllCache(includeDiskFiles: Bool, completionHandler: @escaping () -> Void) { + var websiteDataTypes = Set([WKWebsiteDataTypeMemoryCache]) + if includeDiskFiles { + websiteDataTypes.insert(WKWebsiteDataTypeDiskCache) + if #available(macOS 10.13.4, *) { + websiteDataTypes.insert(WKWebsiteDataTypeFetchCache) + } + websiteDataTypes.insert(WKWebsiteDataTypeOfflineWebApplicationCache) + } + let date = NSDate(timeIntervalSince1970: 0) + WKWebsiteDataStore.default().removeData(ofTypes: websiteDataTypes, modifiedSince: date as Date, completionHandler: completionHandler) + } + public override func dispose() { super.dispose() let keepAliveWebViewValues = keepAliveWebViews.values diff --git a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewSettings.swift b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewSettings.swift index cb61cfee..7b2b9cba 100755 --- a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewSettings.swift +++ b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebViewSettings.swift @@ -14,6 +14,7 @@ public class InAppWebViewSettings: ISettings { var useShouldOverrideUrlLoading = false var useOnLoadResource = false var useOnDownloadStart = false + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") var clearCache = false var userAgent = "" var applicationNameForUserAgent = "" diff --git a/flutter_inappwebview_macos/macos/Classes/InAppWebView/WebViewChannelDelegateMethods.swift b/flutter_inappwebview_macos/macos/Classes/InAppWebView/WebViewChannelDelegateMethods.swift index 0e30c88a..4810bae3 100644 --- a/flutter_inappwebview_macos/macos/Classes/InAppWebView/WebViewChannelDelegateMethods.swift +++ b/flutter_inappwebview_macos/macos/Classes/InAppWebView/WebViewChannelDelegateMethods.swift @@ -42,6 +42,7 @@ public enum WebViewChannelDelegateMethods: String { case findNext = "findNext" @available(*, deprecated, message: "Use FindInteractionController.clearMatches instead.") case clearMatches = "clearMatches" + @available(*, deprecated, message: "Use InAppWebViewManager.clearAllCache instead.") case clearCache = "clearCache" case scrollTo = "scrollTo" case scrollBy = "scrollBy" diff --git a/flutter_inappwebview_platform_interface/CHANGELOG.md b/flutter_inappwebview_platform_interface/CHANGELOG.md index 9484925b..c149ce72 100644 --- a/flutter_inappwebview_platform_interface/CHANGELOG.md +++ b/flutter_inappwebview_platform_interface/CHANGELOG.md @@ -1,7 +1,10 @@ ## 1.0.6 -- Updated `InAppWebViewSettings.useShouldInterceptAjaxRequest` docs - Added `InAppWebViewSettings.interceptOnlyAsyncAjaxRequests` [#1905](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1905) +- Added `PlatformInAppWebViewController.clearFormData` method +- Added `PlatformCookieManager.removeSessionCookies` method +- Updated `InAppWebViewSettings.useShouldInterceptAjaxRequest` docs +- Updated `PlatformCookieManager` methods return value ## 1.0.5 diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/platform_chrome_safari_browser.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/platform_chrome_safari_browser.dart index 13ec3431..651e38cb 100755 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/platform_chrome_safari_browser.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/platform_chrome_safari_browser.dart @@ -41,7 +41,7 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.id} ///View ID used internally. - ///@{endtemplate} + ///{@endtemplate} String get id { throw UnimplementedError('id is not implemented on the current platform'); } diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/platform_in_app_browser.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/platform_in_app_browser.dart index 45921073..f57e69aa 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/platform_in_app_browser.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/platform_in_app_browser.dart @@ -64,7 +64,7 @@ class PlatformInAppBrowserCreationParams { ///- Android native WebView ///- iOS ///- MacOS -///@{endtemplate} +///{@endtemplate} abstract class PlatformInAppBrowser extends PlatformInterface implements Disposable { ///Debug settings. @@ -75,43 +75,43 @@ abstract class PlatformInAppBrowser extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.id} ///View ID used internally. - ///@{endtemplate} + ///{@endtemplate} String get id { throw UnimplementedError('id is not implemented on the current platform'); } ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.contextMenu} ///Context menu used by the browser. It should be set before opening the browser. - ///@{endtemplate} + ///{@endtemplate} ContextMenu? get contextMenu => params.contextMenu; ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.pullToRefreshController} ///Represents the pull-to-refresh feature controller. - ///@{endtemplate} + ///{@endtemplate} PlatformPullToRefreshController? get pullToRefreshController => params.pullToRefreshController; ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.findInteractionController} ///Represents the find interaction feature controller. - ///@{endtemplate} + ///{@endtemplate} PlatformFindInteractionController? get findInteractionController => params.findInteractionController; ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.initialUserScripts} ///Initial list of user scripts to be loaded at start or end of a page loading. - ///@{endtemplate} + ///{@endtemplate} UnmodifiableListView? get initialUserScripts => params.initialUserScripts; ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.windowId} ///The window id of a [CreateWindowAction.windowId]. - ///@{endtemplate} + ///{@endtemplate} int? get windowId => params.windowId; ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.webViewController} ///WebView Controller that can be used to access the [PlatformInAppWebViewController] API. ///When [onExit] is fired, this will be `null` and cannot be used anymore. - ///@{endtemplate} + ///{@endtemplate} PlatformInAppWebViewController? get webViewController { throw UnimplementedError( 'webViewController is not implemented on the current platform'); diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.dart index 8177772d..a53edcc2 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.dart @@ -79,7 +79,8 @@ class InAppWebViewSettings_ { platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()]) bool? useOnDownloadStart; - ///Set to `true` to have all the browser's cache cleared before the new WebView is opened. The default value is `false`. + ///Use [PlatformInAppWebViewController.clearAllCache] instead. + @Deprecated("Use InAppWebViewController.clearAllCache instead") @SupportedPlatforms( platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()]) bool? clearCache; @@ -398,7 +399,8 @@ because there isn't any way to make the website data store non-persistent for th ]) int? textZoom; - ///Set to `true` to have the session cookie cache cleared before the new window is opened. + ///Use [PlatformCookieManager.removeSessionCookies] instead. + @Deprecated("Use CookieManager.removeSessionCookies instead") @SupportedPlatforms(platforms: [AndroidPlatform()]) bool? clearSessionCache; diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.g.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.g.dart index d47bab86..3ae73665 100644 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_settings.g.dart @@ -280,18 +280,20 @@ class InAppWebViewSettings { ///- Android native WebView ([Official API - WebSettings.setCacheMode](https://developer.android.com/reference/android/webkit/WebSettings#setCacheMode(int))) CacheMode? cacheMode; - ///Set to `true` to have all the browser's cache cleared before the new WebView is opened. The default value is `false`. + ///Use [PlatformInAppWebViewController.clearAllCache] instead. /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + @Deprecated('Use InAppWebViewController.clearAllCache instead') bool? clearCache; - ///Set to `true` to have the session cookie cache cleared before the new window is opened. + ///Use [PlatformCookieManager.removeSessionCookies] instead. /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView + @Deprecated('Use CookieManager.removeSessionCookies instead') bool? clearSessionCache; ///List of [ContentBlocker] that are a set of rules used to block content in the browser window. @@ -1454,8 +1456,8 @@ class InAppWebViewSettings { instance.builtInZoomControls = map['builtInZoomControls']; instance.cacheEnabled = map['cacheEnabled']; instance.cacheMode = CacheMode.fromNativeValue(map['cacheMode']); - instance.clearCache = map['clearCache']; - instance.clearSessionCache = map['clearSessionCache']; + instance.clearCache = map['InAppWebViewController.clearAllCache']; + instance.clearSessionCache = map['CookieManager.removeSessionCookies']; instance.contentBlockers = _deserializeContentBlockers(map['contentBlockers']); instance.contentInsetAdjustmentBehavior = @@ -1591,8 +1593,6 @@ class InAppWebViewSettings { "builtInZoomControls": builtInZoomControls, "cacheEnabled": cacheEnabled, "cacheMode": cacheMode?.toNativeValue(), - "clearCache": clearCache, - "clearSessionCache": clearSessionCache, "contentBlockers": contentBlockers?.map((e) => e.toMap()).toList(), "contentInsetAdjustmentBehavior": contentInsetAdjustmentBehavior?.toNativeValue(), @@ -1725,6 +1725,6 @@ class InAppWebViewSettings { @override String toString() { - return 'InAppWebViewSettings{accessibilityIgnoresInvertColors: $accessibilityIgnoresInvertColors, algorithmicDarkeningAllowed: $algorithmicDarkeningAllowed, allowBackgroundAudioPlaying: $allowBackgroundAudioPlaying, allowContentAccess: $allowContentAccess, allowFileAccess: $allowFileAccess, allowFileAccessFromFileURLs: $allowFileAccessFromFileURLs, allowUniversalAccessFromFileURLs: $allowUniversalAccessFromFileURLs, allowingReadAccessTo: $allowingReadAccessTo, allowsAirPlayForMediaPlayback: $allowsAirPlayForMediaPlayback, allowsBackForwardNavigationGestures: $allowsBackForwardNavigationGestures, allowsInlineMediaPlayback: $allowsInlineMediaPlayback, allowsLinkPreview: $allowsLinkPreview, allowsPictureInPictureMediaPlayback: $allowsPictureInPictureMediaPlayback, alwaysBounceHorizontal: $alwaysBounceHorizontal, alwaysBounceVertical: $alwaysBounceVertical, appCachePath: $appCachePath, applePayAPIEnabled: $applePayAPIEnabled, applicationNameForUserAgent: $applicationNameForUserAgent, automaticallyAdjustsScrollIndicatorInsets: $automaticallyAdjustsScrollIndicatorInsets, blockNetworkImage: $blockNetworkImage, blockNetworkLoads: $blockNetworkLoads, builtInZoomControls: $builtInZoomControls, cacheEnabled: $cacheEnabled, cacheMode: $cacheMode, clearCache: $clearCache, clearSessionCache: $clearSessionCache, contentBlockers: $contentBlockers, contentInsetAdjustmentBehavior: $contentInsetAdjustmentBehavior, cursiveFontFamily: $cursiveFontFamily, dataDetectorTypes: $dataDetectorTypes, databaseEnabled: $databaseEnabled, decelerationRate: $decelerationRate, defaultFixedFontSize: $defaultFixedFontSize, defaultFontSize: $defaultFontSize, defaultTextEncodingName: $defaultTextEncodingName, defaultVideoPoster: $defaultVideoPoster, disableContextMenu: $disableContextMenu, disableDefaultErrorPage: $disableDefaultErrorPage, disableHorizontalScroll: $disableHorizontalScroll, disableInputAccessoryView: $disableInputAccessoryView, disableLongPressContextMenuOnLinks: $disableLongPressContextMenuOnLinks, disableVerticalScroll: $disableVerticalScroll, disabledActionModeMenuItems: $disabledActionModeMenuItems, disallowOverScroll: $disallowOverScroll, displayZoomControls: $displayZoomControls, domStorageEnabled: $domStorageEnabled, enableViewportScale: $enableViewportScale, enterpriseAuthenticationAppLinkPolicyEnabled: $enterpriseAuthenticationAppLinkPolicyEnabled, fantasyFontFamily: $fantasyFontFamily, fixedFontFamily: $fixedFontFamily, forceDark: $forceDark, forceDarkStrategy: $forceDarkStrategy, geolocationEnabled: $geolocationEnabled, hardwareAcceleration: $hardwareAcceleration, horizontalScrollBarEnabled: $horizontalScrollBarEnabled, horizontalScrollbarThumbColor: $horizontalScrollbarThumbColor, horizontalScrollbarTrackColor: $horizontalScrollbarTrackColor, iframeAllow: $iframeAllow, iframeAllowFullscreen: $iframeAllowFullscreen, iframeCsp: $iframeCsp, iframeName: $iframeName, iframeReferrerPolicy: $iframeReferrerPolicy, iframeSandbox: $iframeSandbox, ignoresViewportScaleLimits: $ignoresViewportScaleLimits, incognito: $incognito, initialScale: $initialScale, interceptOnlyAsyncAjaxRequests: $interceptOnlyAsyncAjaxRequests, isDirectionalLockEnabled: $isDirectionalLockEnabled, isElementFullscreenEnabled: $isElementFullscreenEnabled, isFindInteractionEnabled: $isFindInteractionEnabled, isFraudulentWebsiteWarningEnabled: $isFraudulentWebsiteWarningEnabled, isInspectable: $isInspectable, isPagingEnabled: $isPagingEnabled, isSiteSpecificQuirksModeEnabled: $isSiteSpecificQuirksModeEnabled, isTextInteractionEnabled: $isTextInteractionEnabled, javaScriptCanOpenWindowsAutomatically: $javaScriptCanOpenWindowsAutomatically, javaScriptEnabled: $javaScriptEnabled, layoutAlgorithm: $layoutAlgorithm, limitsNavigationsToAppBoundDomains: $limitsNavigationsToAppBoundDomains, loadWithOverviewMode: $loadWithOverviewMode, loadsImagesAutomatically: $loadsImagesAutomatically, maximumViewportInset: $maximumViewportInset, maximumZoomScale: $maximumZoomScale, mediaPlaybackRequiresUserGesture: $mediaPlaybackRequiresUserGesture, mediaType: $mediaType, minimumFontSize: $minimumFontSize, minimumLogicalFontSize: $minimumLogicalFontSize, minimumViewportInset: $minimumViewportInset, minimumZoomScale: $minimumZoomScale, mixedContentMode: $mixedContentMode, needInitialFocus: $needInitialFocus, networkAvailable: $networkAvailable, offscreenPreRaster: $offscreenPreRaster, overScrollMode: $overScrollMode, pageZoom: $pageZoom, preferredContentMode: $preferredContentMode, regexToCancelSubFramesLoading: $regexToCancelSubFramesLoading, rendererPriorityPolicy: $rendererPriorityPolicy, requestedWithHeaderOriginAllowList: $requestedWithHeaderOriginAllowList, resourceCustomSchemes: $resourceCustomSchemes, safeBrowsingEnabled: $safeBrowsingEnabled, sansSerifFontFamily: $sansSerifFontFamily, saveFormData: $saveFormData, scrollBarDefaultDelayBeforeFade: $scrollBarDefaultDelayBeforeFade, scrollBarFadeDuration: $scrollBarFadeDuration, scrollBarStyle: $scrollBarStyle, scrollbarFadingEnabled: $scrollbarFadingEnabled, scrollsToTop: $scrollsToTop, selectionGranularity: $selectionGranularity, serifFontFamily: $serifFontFamily, sharedCookiesEnabled: $sharedCookiesEnabled, shouldPrintBackgrounds: $shouldPrintBackgrounds, standardFontFamily: $standardFontFamily, supportMultipleWindows: $supportMultipleWindows, supportZoom: $supportZoom, suppressesIncrementalRendering: $suppressesIncrementalRendering, textZoom: $textZoom, thirdPartyCookiesEnabled: $thirdPartyCookiesEnabled, transparentBackground: $transparentBackground, underPageBackgroundColor: $underPageBackgroundColor, upgradeKnownHostsToHTTPS: $upgradeKnownHostsToHTTPS, useHybridComposition: $useHybridComposition, useOnDownloadStart: $useOnDownloadStart, useOnLoadResource: $useOnLoadResource, useOnNavigationResponse: $useOnNavigationResponse, useOnRenderProcessGone: $useOnRenderProcessGone, useShouldInterceptAjaxRequest: $useShouldInterceptAjaxRequest, useShouldInterceptFetchRequest: $useShouldInterceptFetchRequest, useShouldInterceptRequest: $useShouldInterceptRequest, useShouldOverrideUrlLoading: $useShouldOverrideUrlLoading, useWideViewPort: $useWideViewPort, userAgent: $userAgent, verticalScrollBarEnabled: $verticalScrollBarEnabled, verticalScrollbarPosition: $verticalScrollbarPosition, verticalScrollbarThumbColor: $verticalScrollbarThumbColor, verticalScrollbarTrackColor: $verticalScrollbarTrackColor, webViewAssetLoader: $webViewAssetLoader}'; + return 'InAppWebViewSettings{accessibilityIgnoresInvertColors: $accessibilityIgnoresInvertColors, algorithmicDarkeningAllowed: $algorithmicDarkeningAllowed, allowBackgroundAudioPlaying: $allowBackgroundAudioPlaying, allowContentAccess: $allowContentAccess, allowFileAccess: $allowFileAccess, allowFileAccessFromFileURLs: $allowFileAccessFromFileURLs, allowUniversalAccessFromFileURLs: $allowUniversalAccessFromFileURLs, allowingReadAccessTo: $allowingReadAccessTo, allowsAirPlayForMediaPlayback: $allowsAirPlayForMediaPlayback, allowsBackForwardNavigationGestures: $allowsBackForwardNavigationGestures, allowsInlineMediaPlayback: $allowsInlineMediaPlayback, allowsLinkPreview: $allowsLinkPreview, allowsPictureInPictureMediaPlayback: $allowsPictureInPictureMediaPlayback, alwaysBounceHorizontal: $alwaysBounceHorizontal, alwaysBounceVertical: $alwaysBounceVertical, appCachePath: $appCachePath, applePayAPIEnabled: $applePayAPIEnabled, applicationNameForUserAgent: $applicationNameForUserAgent, automaticallyAdjustsScrollIndicatorInsets: $automaticallyAdjustsScrollIndicatorInsets, blockNetworkImage: $blockNetworkImage, blockNetworkLoads: $blockNetworkLoads, builtInZoomControls: $builtInZoomControls, cacheEnabled: $cacheEnabled, cacheMode: $cacheMode, contentBlockers: $contentBlockers, contentInsetAdjustmentBehavior: $contentInsetAdjustmentBehavior, cursiveFontFamily: $cursiveFontFamily, dataDetectorTypes: $dataDetectorTypes, databaseEnabled: $databaseEnabled, decelerationRate: $decelerationRate, defaultFixedFontSize: $defaultFixedFontSize, defaultFontSize: $defaultFontSize, defaultTextEncodingName: $defaultTextEncodingName, defaultVideoPoster: $defaultVideoPoster, disableContextMenu: $disableContextMenu, disableDefaultErrorPage: $disableDefaultErrorPage, disableHorizontalScroll: $disableHorizontalScroll, disableInputAccessoryView: $disableInputAccessoryView, disableLongPressContextMenuOnLinks: $disableLongPressContextMenuOnLinks, disableVerticalScroll: $disableVerticalScroll, disabledActionModeMenuItems: $disabledActionModeMenuItems, disallowOverScroll: $disallowOverScroll, displayZoomControls: $displayZoomControls, domStorageEnabled: $domStorageEnabled, enableViewportScale: $enableViewportScale, enterpriseAuthenticationAppLinkPolicyEnabled: $enterpriseAuthenticationAppLinkPolicyEnabled, fantasyFontFamily: $fantasyFontFamily, fixedFontFamily: $fixedFontFamily, forceDark: $forceDark, forceDarkStrategy: $forceDarkStrategy, geolocationEnabled: $geolocationEnabled, hardwareAcceleration: $hardwareAcceleration, horizontalScrollBarEnabled: $horizontalScrollBarEnabled, horizontalScrollbarThumbColor: $horizontalScrollbarThumbColor, horizontalScrollbarTrackColor: $horizontalScrollbarTrackColor, iframeAllow: $iframeAllow, iframeAllowFullscreen: $iframeAllowFullscreen, iframeCsp: $iframeCsp, iframeName: $iframeName, iframeReferrerPolicy: $iframeReferrerPolicy, iframeSandbox: $iframeSandbox, ignoresViewportScaleLimits: $ignoresViewportScaleLimits, incognito: $incognito, initialScale: $initialScale, interceptOnlyAsyncAjaxRequests: $interceptOnlyAsyncAjaxRequests, isDirectionalLockEnabled: $isDirectionalLockEnabled, isElementFullscreenEnabled: $isElementFullscreenEnabled, isFindInteractionEnabled: $isFindInteractionEnabled, isFraudulentWebsiteWarningEnabled: $isFraudulentWebsiteWarningEnabled, isInspectable: $isInspectable, isPagingEnabled: $isPagingEnabled, isSiteSpecificQuirksModeEnabled: $isSiteSpecificQuirksModeEnabled, isTextInteractionEnabled: $isTextInteractionEnabled, javaScriptCanOpenWindowsAutomatically: $javaScriptCanOpenWindowsAutomatically, javaScriptEnabled: $javaScriptEnabled, layoutAlgorithm: $layoutAlgorithm, limitsNavigationsToAppBoundDomains: $limitsNavigationsToAppBoundDomains, loadWithOverviewMode: $loadWithOverviewMode, loadsImagesAutomatically: $loadsImagesAutomatically, maximumViewportInset: $maximumViewportInset, maximumZoomScale: $maximumZoomScale, mediaPlaybackRequiresUserGesture: $mediaPlaybackRequiresUserGesture, mediaType: $mediaType, minimumFontSize: $minimumFontSize, minimumLogicalFontSize: $minimumLogicalFontSize, minimumViewportInset: $minimumViewportInset, minimumZoomScale: $minimumZoomScale, mixedContentMode: $mixedContentMode, needInitialFocus: $needInitialFocus, networkAvailable: $networkAvailable, offscreenPreRaster: $offscreenPreRaster, overScrollMode: $overScrollMode, pageZoom: $pageZoom, preferredContentMode: $preferredContentMode, regexToCancelSubFramesLoading: $regexToCancelSubFramesLoading, rendererPriorityPolicy: $rendererPriorityPolicy, requestedWithHeaderOriginAllowList: $requestedWithHeaderOriginAllowList, resourceCustomSchemes: $resourceCustomSchemes, safeBrowsingEnabled: $safeBrowsingEnabled, sansSerifFontFamily: $sansSerifFontFamily, saveFormData: $saveFormData, scrollBarDefaultDelayBeforeFade: $scrollBarDefaultDelayBeforeFade, scrollBarFadeDuration: $scrollBarFadeDuration, scrollBarStyle: $scrollBarStyle, scrollbarFadingEnabled: $scrollbarFadingEnabled, scrollsToTop: $scrollsToTop, selectionGranularity: $selectionGranularity, serifFontFamily: $serifFontFamily, sharedCookiesEnabled: $sharedCookiesEnabled, shouldPrintBackgrounds: $shouldPrintBackgrounds, standardFontFamily: $standardFontFamily, supportMultipleWindows: $supportMultipleWindows, supportZoom: $supportZoom, suppressesIncrementalRendering: $suppressesIncrementalRendering, textZoom: $textZoom, thirdPartyCookiesEnabled: $thirdPartyCookiesEnabled, transparentBackground: $transparentBackground, underPageBackgroundColor: $underPageBackgroundColor, upgradeKnownHostsToHTTPS: $upgradeKnownHostsToHTTPS, useHybridComposition: $useHybridComposition, useOnDownloadStart: $useOnDownloadStart, useOnLoadResource: $useOnLoadResource, useOnNavigationResponse: $useOnNavigationResponse, useOnRenderProcessGone: $useOnRenderProcessGone, useShouldInterceptAjaxRequest: $useShouldInterceptAjaxRequest, useShouldInterceptFetchRequest: $useShouldInterceptFetchRequest, useShouldInterceptRequest: $useShouldInterceptRequest, useShouldOverrideUrlLoading: $useShouldOverrideUrlLoading, useWideViewPort: $useWideViewPort, userAgent: $userAgent, verticalScrollBarEnabled: $verticalScrollBarEnabled, verticalScrollbarPosition: $verticalScrollbarPosition, verticalScrollbarThumbColor: $verticalScrollbarThumbColor, verticalScrollbarTrackColor: $verticalScrollbarTrackColor, webViewAssetLoader: $webViewAssetLoader}'; } } diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/platform_inappwebview_controller.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/platform_inappwebview_controller.dart index d66eba5d..952ab49d 100644 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/platform_inappwebview_controller.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/platform_inappwebview_controller.dart @@ -19,6 +19,7 @@ import '../in_app_browser/platform_in_app_browser.dart'; import 'platform_headless_in_app_webview.dart'; import 'platform_inappwebview_widget.dart'; import '../platform_webview_feature.dart'; +import '../find_interaction/platform_find_interaction_controller.dart'; import 'platform_webview.dart'; import 'in_app_webview_keep_alive.dart'; @@ -107,17 +108,17 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.id} /// WebView ID. - ///@{endtemplate} + ///{@endtemplate} dynamic get id => params.id; ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.webviewParams} /// WebView params. - ///@{endtemplate} + ///{@endtemplate} PlatformWebViewCreationParams? get webviewParams => params.webviewParams; ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.webStorage} ///Provides access to the JavaScript [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API): `window.sessionStorage` and `window.localStorage`. - ///@{endtemplate} + ///{@endtemplate} PlatformWebStorage get webStorage => throw UnimplementedError( 'webStorage is not implemented on the current platform'); @@ -133,7 +134,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url)) ///- MacOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getUrl() { throw UnimplementedError( 'getUrl is not implemented on the current platform'); @@ -149,7 +150,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title)) ///- MacOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getTitle() { throw UnimplementedError( 'getTitle is not implemented on the current platform'); @@ -162,7 +163,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.getProgress](https://developer.android.com/reference/android/webkit/WebView#getProgress())) ///- iOS ([Official API - WKWebView.estimatedProgress](https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress)) ///- MacOS ([Official API - WKWebView.estimatedProgress](https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress)) - ///@{endtemplate} + ///{@endtemplate} Future getProgress() { throw UnimplementedError( 'getProgress is not implemented on the current platform'); @@ -181,7 +182,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getHtml() { throw UnimplementedError( 'getHtml is not implemented on the current platform'); @@ -197,7 +198,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future> getFavicons() { throw UnimplementedError( 'getFavicons is not implemented on the current platform'); @@ -223,7 +224,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl)) ///- MacOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future loadUrl( {required URLRequest urlRequest, @Deprecated('Use allowingReadAccessTo instead') @@ -249,7 +250,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future postUrl({required WebUri url, required Uint8List postData}) { throw UnimplementedError( 'postUrl is not implemented on the current platform'); @@ -275,7 +276,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.loadHTMLString](https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring) or [Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1415011-load)) ///- MacOS ([Official API - WKWebView.loadHTMLString](https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring) or [Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1415011-load)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future loadData( {required String data, String mimeType = "text/html", @@ -326,7 +327,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load)) ///- MacOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future loadFile({required String assetFilePath}) { throw UnimplementedError( 'loadFile is not implemented on the current platform'); @@ -342,7 +343,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload)) ///- MacOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload)) ///- Web ([Official API - Location.reload](https://developer.mozilla.org/en-US/docs/Web/API/Location/reload)) - ///@{endtemplate} + ///{@endtemplate} Future reload() { throw UnimplementedError( 'reload is not implemented on the current platform'); @@ -358,7 +359,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback)) ///- MacOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback)) ///- Web ([Official API - History.back](https://developer.mozilla.org/en-US/docs/Web/API/History/back)) - ///@{endtemplate} + ///{@endtemplate} Future goBack() { throw UnimplementedError( 'goBack is not implemented on the current platform'); @@ -371,7 +372,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.canGoBack](https://developer.android.com/reference/android/webkit/WebView#canGoBack())) ///- iOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback)) ///- MacOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback)) - ///@{endtemplate} + ///{@endtemplate} Future canGoBack() { throw UnimplementedError( 'canGoBack is not implemented on the current platform'); @@ -387,7 +388,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward)) ///- MacOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward)) ///- Web ([Official API - History.forward](https://developer.mozilla.org/en-US/docs/Web/API/History/forward)) - ///@{endtemplate} + ///{@endtemplate} Future goForward() { throw UnimplementedError( 'goForward is not implemented on the current platform'); @@ -400,7 +401,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.canGoForward](https://developer.android.com/reference/android/webkit/WebView#canGoForward())) ///- iOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward)) ///- MacOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward)) - ///@{endtemplate} + ///{@endtemplate} Future canGoForward() { throw UnimplementedError( 'canGoForward is not implemented on the current platform'); @@ -416,7 +417,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go)) ///- MacOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go)) ///- Web ([Official API - History.go](https://developer.mozilla.org/en-US/docs/Web/API/History/go)) - ///@{endtemplate} + ///{@endtemplate} Future goBackOrForward({required int steps}) { throw UnimplementedError( 'goBackOrForward is not implemented on the current platform'); @@ -429,7 +430,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.canGoBackOrForward](https://developer.android.com/reference/android/webkit/WebView#canGoBackOrForward(int))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future canGoBackOrForward({required int steps}) { throw UnimplementedError( 'canGoBackOrForward is not implemented on the current platform'); @@ -445,7 +446,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future goTo({required WebHistoryItem historyItem}) { throw UnimplementedError('goTo is not implemented on the current platform'); } @@ -458,7 +459,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future isLoading() { throw UnimplementedError( 'isLoading is not implemented on the current platform'); @@ -474,7 +475,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading)) ///- MacOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading)) ///- Web ([Official API - Window.stop](https://developer.mozilla.org/en-US/docs/Web/API/Window/stop)) - ///@{endtemplate} + ///{@endtemplate} Future stopLoading() { throw UnimplementedError( 'stopLoading is not implemented on the current platform'); @@ -503,7 +504,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.evaluateJavascript](https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript)) ///- MacOS ([Official API - WKWebView.evaluateJavascript](https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript)) ///- Web ([Official API - Window.eval](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval?retiredLocale=it)) - ///@{endtemplate} + ///{@endtemplate} Future evaluateJavascript( {required String source, ContentWorld? contentWorld}) { throw UnimplementedError( @@ -527,7 +528,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future injectJavascriptFileFromUrl( {required WebUri urlFile, ScriptHtmlTagAttributes? scriptHtmlTagAttributes}) { @@ -550,7 +551,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future injectJavascriptFileFromAsset( {required String assetFilePath}) { throw UnimplementedError( @@ -572,7 +573,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future injectCSSCode({required String source}) { throw UnimplementedError( 'injectCSSCode is not implemented on the current platform'); @@ -595,7 +596,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future injectCSSFileFromUrl( {required WebUri urlFile, CSSLinkHtmlTagAttributes? cssLinkHtmlTagAttributes}) { @@ -618,7 +619,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future injectCSSFileFromAsset({required String assetFilePath}) { throw UnimplementedError( 'injectCSSFileFromAsset is not implemented on the current platform'); @@ -680,7 +681,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} void addJavaScriptHandler( {required String handlerName, required JavaScriptHandlerCallback callback}) { @@ -697,7 +698,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} JavaScriptHandlerCallback? removeJavaScriptHandler( {required String handlerName}) { throw UnimplementedError( @@ -711,7 +712,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} bool hasJavaScriptHandler({required String handlerName}) { throw UnimplementedError( 'hasJavaScriptHandler is not implemented on the current platform'); @@ -730,7 +731,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ([Official API - WKWebView.takeSnapshot](https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot)) ///- MacOS ([Official API - WKWebView.takeSnapshot](https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot)) - ///@{endtemplate} + ///{@endtemplate} Future takeScreenshot( {ScreenshotConfiguration? screenshotConfiguration}) { throw UnimplementedError( @@ -745,7 +746,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future setSettings({required InAppWebViewSettings settings}) { throw UnimplementedError( 'setSettings is not implemented on the current platform'); @@ -759,7 +760,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getSettings() { throw UnimplementedError( 'getSettings is not implemented on the current platform'); @@ -775,20 +776,16 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.copyBackForwardList](https://developer.android.com/reference/android/webkit/WebView#copyBackForwardList())) ///- iOS ([Official API - WKWebView.backForwardList](https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist)) ///- MacOS ([Official API - WKWebView.backForwardList](https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist)) - ///@{endtemplate} + ///{@endtemplate} Future getCopyBackForwardList() { throw UnimplementedError( 'getCopyBackForwardList is not implemented on the current platform'); } ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearCache} - ///Clears all the WebView's cache. - /// - ///**Officially Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///@{endtemplate} + ///Use [PlatformInAppWebViewController.clearAllCache] instead + ///{@endtemplate} + @Deprecated("Use InAppWebViewController.clearAllCache instead") Future clearCache() { throw UnimplementedError( 'clearCache is not implemented on the current platform'); @@ -812,7 +809,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) ///- MacOS ///- Web ([Official API - Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)) - ///@{endtemplate} + ///{@endtemplate} Future scrollTo( {required int x, required int y, bool animated = false}) { throw UnimplementedError( @@ -837,7 +834,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) ///- MacOS ///- Web ([Official API - Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)) - ///@{endtemplate} + ///{@endtemplate} Future scrollBy( {required int x, required int y, bool animated = false}) { throw UnimplementedError( @@ -856,7 +853,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.pauseTimers](https://developer.android.com/reference/android/webkit/WebView#pauseTimers())) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future pauseTimers() { throw UnimplementedError( 'pauseTimers is not implemented on the current platform'); @@ -873,7 +870,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.resumeTimers](https://developer.android.com/reference/android/webkit/WebView#resumeTimers())) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future resumeTimers() { throw UnimplementedError( 'resumeTimers is not implemented on the current platform'); @@ -896,7 +893,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIPrintInteractionController.present](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/1618149-present)) ///- MacOS (if 11.0+, [Official API - WKWebView.printOperation](https://developer.apple.com/documentation/webkit/wkwebview/3516861-printoperation), else [Official API - NSView.printView](https://developer.apple.com/documentation/appkit/nsview/1483705-printview)) ///- Web ([Official API - Window.print](https://developer.mozilla.org/en-US/docs/Web/API/Window/print)) - ///@{endtemplate} + ///{@endtemplate} Future printCurrentPage( {PrintJobSettings? settings}) { throw UnimplementedError( @@ -915,7 +912,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize)) ///- MacOS ///- Web ([Official API - Document.documentElement.scrollHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)) - ///@{endtemplate} + ///{@endtemplate} Future getContentHeight() { throw UnimplementedError( 'getContentHeight is not implemented on the current platform'); @@ -935,7 +932,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize)) ///- MacOS ///- Web ([Official API - Document.documentElement.scrollWidth](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth)) - ///@{endtemplate} + ///{@endtemplate} Future getContentWidth() { throw UnimplementedError( 'getContentWidth is not implemented on the current platform'); @@ -954,7 +951,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.zoomBy](https://developer.android.com/reference/android/webkit/WebView#zoomBy(float))) ///- iOS ([Official API - UIScrollView.setZoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale)) - ///@{endtemplate} + ///{@endtemplate} Future zoomBy( {required double zoomFactor, @Deprecated('Use animated instead') bool? iosAnimated, @@ -975,7 +972,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getOriginalUrl() { throw UnimplementedError( 'getOriginalUrl is not implemented on the current platform'); @@ -987,7 +984,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ([Official API - UIScrollView.zoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619419-zoomscale)) - ///@{endtemplate} + ///{@endtemplate} Future getZoomScale() { throw UnimplementedError( 'getZoomScale is not implemented on the current platform'); @@ -1007,7 +1004,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getSelectedText() { throw UnimplementedError( 'getSelectedText is not implemented on the current platform'); @@ -1021,7 +1018,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.getHitTestResult](https://developer.android.com/reference/android/webkit/WebView#getHitTestResult())) ///- iOS - ///@{endtemplate} + ///{@endtemplate} Future getHitTestResult() { throw UnimplementedError( 'getHitTestResult is not implemented on the current platform'); @@ -1033,7 +1030,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - ViewGroup.clearFocus](https://developer.android.com/reference/android/view/ViewGroup#clearFocus())) ///- iOS ([Official API - UIResponder.resignFirstResponder](https://developer.apple.com/documentation/uikit/uiresponder/1621097-resignfirstresponder)) - ///@{endtemplate} + ///{@endtemplate} Future clearFocus() { throw UnimplementedError( 'clearFocus is not implemented on the current platform'); @@ -1045,7 +1042,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS - ///@{endtemplate} + ///{@endtemplate} Future setContextMenu(ContextMenu? contextMenu) { throw UnimplementedError( 'setContextMenu is not implemented on the current platform'); @@ -1059,7 +1056,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.requestFocusNodeHref](https://developer.android.com/reference/android/webkit/WebView#requestFocusNodeHref(android.os.Message))) ///- iOS - ///@{endtemplate} + ///{@endtemplate} Future requestFocusNodeHref() { throw UnimplementedError( 'requestFocusNodeHref is not implemented on the current platform'); @@ -1073,7 +1070,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.requestImageRef](https://developer.android.com/reference/android/webkit/WebView#requestImageRef(android.os.Message))) ///- iOS - ///@{endtemplate} + ///{@endtemplate} Future requestImageRef() { throw UnimplementedError( 'requestImageRef is not implemented on the current platform'); @@ -1091,7 +1088,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future> getMetaTags() { throw UnimplementedError( 'getMetaTags is not implemented on the current platform'); @@ -1110,7 +1107,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - WKWebView.themeColor](https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor)) ///- MacOS ([Official API - WKWebView.themeColor](https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor)) ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getMetaThemeColor() { throw UnimplementedError( 'getMetaThemeColor is not implemented on the current platform'); @@ -1128,7 +1125,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) ///- MacOS ///- Web ([Official API - Window.scrollX](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX)) - ///@{endtemplate} + ///{@endtemplate} Future getScrollX() { throw UnimplementedError( 'getScrollX is not implemented on the current platform'); @@ -1146,7 +1143,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) ///- MacOS ///- Web ([Official API - Window.scrollY](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY)) - ///@{endtemplate} + ///{@endtemplate} Future getScrollY() { throw UnimplementedError( 'getScrollY is not implemented on the current platform'); @@ -1159,7 +1156,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.getCertificate](https://developer.android.com/reference/android/webkit/WebView#getCertificate())) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future getCertificate() { throw UnimplementedError( 'getCertificate is not implemented on the current platform'); @@ -1176,7 +1173,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ([Official API - WKUserContentController.addUserScript](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript)) ///- MacOS ([Official API - WKUserContentController.addUserScript](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537448-adduserscript)) - ///@{endtemplate} + ///{@endtemplate} Future addUserScript({required UserScript userScript}) { throw UnimplementedError( 'addUserScript is not implemented on the current platform'); @@ -1193,7 +1190,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future addUserScripts({required List userScripts}) { throw UnimplementedError( 'addUserScripts is not implemented on the current platform'); @@ -1212,7 +1209,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future removeUserScript({required UserScript userScript}) { throw UnimplementedError( 'removeUserScript is not implemented on the current platform'); @@ -1230,7 +1227,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future removeUserScriptsByGroupName({required String groupName}) { throw UnimplementedError( 'removeUserScriptsByGroupName is not implemented on the current platform'); @@ -1248,7 +1245,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future removeUserScripts({required List userScripts}) { throw UnimplementedError( 'removeUserScripts is not implemented on the current platform'); @@ -1265,7 +1262,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ([Official API - WKUserContentController.removeAllUserScripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts)) ///- MacOS ([Official API - WKUserContentController.removeAllUserScripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts)) - ///@{endtemplate} + ///{@endtemplate} Future removeAllUserScripts() { throw UnimplementedError( 'removeAllUserScripts is not implemented on the current platform'); @@ -1278,7 +1275,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} bool hasUserScript({required UserScript userScript}) { throw UnimplementedError( 'hasUserScript is not implemented on the current platform'); @@ -1318,7 +1315,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ([Official API - WKWebView.callAsyncJavaScript](https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript)) ///- MacOS ([Official API - WKWebView.callAsyncJavaScript](https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript)) - ///@{endtemplate} + ///{@endtemplate} Future callAsyncJavaScript( {required String functionBody, Map arguments = const {}, @@ -1346,7 +1343,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebView.saveWebArchive](https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future saveWebArchive( {required String filePath, bool autoname = false}) { throw UnimplementedError( @@ -1366,7 +1363,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web ([Official API - Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext)) - ///@{endtemplate} + ///{@endtemplate} Future isSecureContext() { throw UnimplementedError( 'isSecureContext is not implemented on the current platform'); @@ -1390,7 +1387,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebViewCompat.createWebMessageChannel](https://developer.android.com/reference/androidx/webkit/WebViewCompat#createWebMessageChannel(android.webkit.WebView))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future createWebMessageChannel() { throw UnimplementedError( 'createWebMessageChannel is not implemented on the current platform'); @@ -1412,7 +1409,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebViewCompat.postWebMessage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#postWebMessage(android.webkit.WebView,%20androidx.webkit.WebMessageCompat,%20android.net.Uri))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future postWebMessage( {required WebMessage message, WebUri? targetOrigin}) { throw UnimplementedError( @@ -1584,7 +1581,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebViewCompat.WebMessageListener](https://developer.android.com/reference/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,%20java.lang.String,%20java.util.Set%3Cjava.lang.String%3E,%20androidx.webkit.WebViewCompat.WebMessageListener))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future addWebMessageListener( PlatformWebMessageListener webMessageListener) { throw UnimplementedError( @@ -1598,7 +1595,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} bool hasWebMessageListener(PlatformWebMessageListener webMessageListener) { throw UnimplementedError( 'hasWebMessageListener is not implemented on the current platform'); @@ -1616,7 +1613,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future canScrollVertically() { throw UnimplementedError( 'canScrollVertically is not implemented on the current platform'); @@ -1634,7 +1631,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- iOS ///- MacOS ///- Web - ///@{endtemplate} + ///{@endtemplate} Future canScrollHorizontally() { throw UnimplementedError( 'canScrollHorizontally is not implemented on the current platform'); @@ -1653,7 +1650,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.startSafeBrowsing](https://developer.android.com/reference/android/webkit/WebView#startSafeBrowsing(android.content.Context,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) - ///@{endtemplate} + ///{@endtemplate} Future startSafeBrowsing() { throw UnimplementedError( 'startSafeBrowsing is not implemented on the current platform'); @@ -1664,7 +1661,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.clearSslPreferences](https://developer.android.com/reference/android/webkit/WebView#clearSslPreferences())) - ///@{endtemplate} + ///{@endtemplate} Future clearSslPreferences() { throw UnimplementedError( 'clearSslPreferences is not implemented on the current platform'); @@ -1676,7 +1673,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.onPause](https://developer.android.com/reference/android/webkit/WebView#onPause())) - ///@{endtemplate} + ///{@endtemplate} Future pause() { throw UnimplementedError( 'pause is not implemented on the current platform'); @@ -1687,7 +1684,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.onResume](https://developer.android.com/reference/android/webkit/WebView#onResume())) - ///@{endtemplate} + ///{@endtemplate} Future resume() { throw UnimplementedError( 'resume is not implemented on the current platform'); @@ -1701,7 +1698,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.pageDown](https://developer.android.com/reference/android/webkit/WebView#pageDown(boolean))) - ///@{endtemplate} + ///{@endtemplate} Future pageDown({required bool bottom}) { throw UnimplementedError( 'pageDown is not implemented on the current platform'); @@ -1715,7 +1712,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.pageUp](https://developer.android.com/reference/android/webkit/WebView#pageUp(boolean))) - ///@{endtemplate} + ///{@endtemplate} Future pageUp({required bool top}) { throw UnimplementedError( 'pageUp is not implemented on the current platform'); @@ -1727,7 +1724,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.zoomIn](https://developer.android.com/reference/android/webkit/WebView#zoomIn())) - ///@{endtemplate} + ///{@endtemplate} Future zoomIn() { throw UnimplementedError( 'zoomIn is not implemented on the current platform'); @@ -1739,7 +1736,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.zoomOut](https://developer.android.com/reference/android/webkit/WebView#zoomOut())) - ///@{endtemplate} + ///{@endtemplate} Future zoomOut() { throw UnimplementedError( 'zoomOut is not implemented on the current platform'); @@ -1750,19 +1747,32 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.clearHistory](https://developer.android.com/reference/android/webkit/WebView#clearHistory())) - ///@{endtemplate} + ///{@endtemplate} Future clearHistory() { throw UnimplementedError( 'clearHistory is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearFormData} + ///Removes the autocomplete popup from the currently focused form field, if present. + ///Note this only affects the display of the autocomplete popup, + ///it does not remove any saved form data from this WebView's store. + /// + ///**Officially Supported Platforms/Implementations**: + ///- Android native WebView ([Official API - WebView.clearFormData](https://developer.android.com/reference/android/webkit/WebView#clearFormData())) + ///{@endtemplate} + Future clearFormData() { + throw UnimplementedError( + 'clearFormData is not implemented on the current platform'); + } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.reloadFromOrigin} ///Reloads the current page, performing end-to-end revalidation using cache-validating conditionals if possible. /// ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.reloadFromOrigin](https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin)) ///- MacOS ([Official API - WKWebView.reloadFromOrigin](https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin)) - ///@{endtemplate} + ///{@endtemplate} Future reloadFromOrigin() { throw UnimplementedError( 'reloadFromOrigin is not implemented on the current platform'); @@ -1781,7 +1791,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf)) ///- MacOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf)) - ///@{endtemplate} + ///{@endtemplate} Future createPdf( {@Deprecated("Use pdfConfiguration instead") // ignore: deprecated_member_use_from_same_package @@ -1802,7 +1812,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.createWebArchiveData](https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata)) ///- MacOS ([Official API - WKWebView.createWebArchiveData](https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata)) - ///@{endtemplate} + ///{@endtemplate} Future createWebArchiveData() { throw UnimplementedError( 'createWebArchiveData is not implemented on the current platform'); @@ -1814,7 +1824,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.hasOnlySecureContent](https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent)) ///- MacOS ([Official API - WKWebView.hasOnlySecureContent](https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent)) - ///@{endtemplate} + ///{@endtemplate} Future hasOnlySecureContent() { throw UnimplementedError( 'hasOnlySecureContent is not implemented on the current platform'); @@ -1830,7 +1840,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.pauseAllMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback)) ///- MacOS ([Official API - WKWebView.pauseAllMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebview/3752240-pauseallmediaplayback)) - ///@{endtemplate} + ///{@endtemplate} Future pauseAllMediaPlayback() { throw UnimplementedError( 'pauseAllMediaPlayback is not implemented on the current platform'); @@ -1849,7 +1859,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.setAllMediaPlaybackSuspended](https://developer.apple.com/documentation/webkit/wkwebview/3752242-setallmediaplaybacksuspended)) ///- MacOS ([Official API - WKWebView.setAllMediaPlaybackSuspended](https://developer.apple.com/documentation/webkit/wkwebview/3752242-setallmediaplaybacksuspended)) - ///@{endtemplate} + ///{@endtemplate} Future setAllMediaPlaybackSuspended({required bool suspended}) { throw UnimplementedError( 'setAllMediaPlaybackSuspended is not implemented on the current platform'); @@ -1865,7 +1875,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.closeAllMediaPresentations](https://developer.apple.com/documentation/webkit/wkwebview/3752235-closeallmediapresentations)) ///- MacOS ([Official API - WKWebView.closeAllMediaPresentations](https://developer.apple.com/documentation/webkit/wkwebview/3752235-closeallmediapresentations)) - ///@{endtemplate} + ///{@endtemplate} Future closeAllMediaPresentations() { throw UnimplementedError( 'closeAllMediaPresentations is not implemented on the current platform'); @@ -1883,7 +1893,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.requestMediaPlaybackState](https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate)) ///- MacOS ([Official API - WKWebView.requestMediaPlaybackState](https://developer.apple.com/documentation/webkit/wkwebview/3752241-requestmediaplaybackstate)) - ///@{endtemplate} + ///{@endtemplate} Future requestMediaPlaybackState() { throw UnimplementedError( 'requestMediaPlaybackState is not implemented on the current platform'); @@ -1896,7 +1906,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future isInFullscreen() { throw UnimplementedError( 'isInFullscreen is not implemented on the current platform'); @@ -1912,7 +1922,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.cameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763093-cameracapturestate)) ///- MacOS ([Official API - WKWebView.cameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763093-cameracapturestate)) - ///@{endtemplate} + ///{@endtemplate} Future getCameraCaptureState() { throw UnimplementedError( 'getCameraCaptureState is not implemented on the current platform'); @@ -1928,7 +1938,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)) ///- MacOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)) - ///@{endtemplate} + ///{@endtemplate} Future setCameraCaptureState({required MediaCaptureState state}) { throw UnimplementedError( 'setCameraCaptureState is not implemented on the current platform'); @@ -1944,7 +1954,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.microphoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763096-microphonecapturestate)) ///- MacOS ([Official API - WKWebView.microphoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763096-microphonecapturestate)) - ///@{endtemplate} + ///{@endtemplate} Future getMicrophoneCaptureState() { throw UnimplementedError( 'getMicrophoneCaptureState is not implemented on the current platform'); @@ -1960,7 +1970,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.setMicrophoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763098-setmicrophonecapturestate)) ///- MacOS ([Official API - WKWebView.setMicrophoneCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763098-setmicrophonecapturestate)) - ///@{endtemplate} + ///{@endtemplate} Future setMicrophoneCaptureState({required MediaCaptureState state}) { throw UnimplementedError( 'setMicrophoneCaptureState is not implemented on the current platform'); @@ -1992,7 +2002,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)](https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest) and [Official API - WKWebView.loadSimulatedRequest(_:responseHTML:)](https://developer.apple.com/documentation/webkit/wkwebview/3763095-loadsimulatedrequest)) ///- MacOS ([Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)](https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest) and [Official API - WKWebView.loadSimulatedRequest(_:responseHTML:)](https://developer.apple.com/documentation/webkit/wkwebview/3763095-loadsimulatedrequest)) - ///@{endtemplate} + ///{@endtemplate} Future loadSimulatedRequest( {required URLRequest urlRequest, required Uint8List data, @@ -2006,7 +2016,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Web - ///@{endtemplate} + ///{@endtemplate} Future getIFrameId() { throw UnimplementedError( 'getIFrameId is not implemented on the current platform'); @@ -2014,7 +2024,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getViewId} ///View ID used internally. - ///@{endtemplate} + ///{@endtemplate} dynamic getViewId() { throw UnimplementedError( 'getViewId is not implemented on the current platform'); @@ -2027,7 +2037,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ([Official API - WebSettings.getDefaultUserAgent](https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context))) ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future getDefaultUserAgent() { throw UnimplementedError( 'getDefaultUserAgent is not implemented on the current platform'); @@ -2044,7 +2054,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.clearClientCertPreferences](https://developer.android.com/reference/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable))) - ///@{endtemplate} + ///{@endtemplate} Future clearClientCertPreferences() { throw UnimplementedError( 'clearClientCertPreferences is not implemented on the current platform'); @@ -2057,7 +2067,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewCompat.getSafeBrowsingPrivacyPolicyUrl](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl())) - ///@{endtemplate} + ///{@endtemplate} Future getSafeBrowsingPrivacyPolicyUrl() { throw UnimplementedError( 'getSafeBrowsingPrivacyPolicyUrl is not implemented on the current platform'); @@ -2082,7 +2092,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewCompat.setSafeBrowsingAllowlist](https://developer.android.com/reference/androidx/webkit/WebViewCompat#setSafeBrowsingAllowlist(java.util.Set%3Cjava.lang.String%3E,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) - ///@{endtemplate} + ///{@endtemplate} Future setSafeBrowsingAllowlist({required List hosts}) { throw UnimplementedError( 'setSafeBrowsingAllowlist is not implemented on the current platform'); @@ -2101,7 +2111,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewCompat.getCurrentWebViewPackage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context))) - ///@{endtemplate} + ///{@endtemplate} Future getCurrentWebViewPackage() { throw UnimplementedError( 'getCurrentWebViewPackage is not implemented on the current platform'); @@ -2118,7 +2128,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.setWebContentsDebuggingEnabled](https://developer.android.com/reference/android/webkit/WebView#setWebContentsDebuggingEnabled(boolean))) - ///@{endtemplate} + ///{@endtemplate} Future setWebContentsDebuggingEnabled(bool debuggingEnabled) { throw UnimplementedError( 'setWebContentsDebuggingEnabled is not implemented on the current platform'); @@ -2138,7 +2148,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewCompat.getVariationsHeader](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getVariationsHeader())) - ///@{endtemplate} + ///{@endtemplate} Future getVariationsHeader() { throw UnimplementedError( 'getVariationsHeader is not implemented on the current platform'); @@ -2157,7 +2167,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewCompat.isMultiProcessEnabled](https://developer.android.com/reference/androidx/webkit/WebViewCompat#isMultiProcessEnabled())) - ///@{endtemplate} + ///{@endtemplate} Future isMultiProcessEnabled() { throw UnimplementedError( 'isMultiProcessEnabled is not implemented on the current platform'); @@ -2177,7 +2187,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface /// ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.disableWebView](https://developer.android.com/reference/android/webkit/WebView.html#disableWebView())) - ///@{endtemplate} + ///{@endtemplate} Future disableWebView() { throw UnimplementedError( 'disableWebView is not implemented on the current platform'); @@ -2195,7 +2205,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.handlesURLScheme](https://developer.apple.com/documentation/webkit/wkwebview/2875370-handlesurlscheme)) ///- MacOS ([Official API - WKWebView.handlesURLScheme](https://developer.apple.com/documentation/webkit/wkwebview/2875370-handlesurlscheme)) - ///@{endtemplate} + ///{@endtemplate} Future handlesURLScheme(String urlScheme) { throw UnimplementedError( 'handlesURLScheme is not implemented on the current platform'); @@ -2208,12 +2218,27 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS - ///@{endtemplate} + ///{@endtemplate} Future disposeKeepAlive(InAppWebViewKeepAlive keepAlive) { throw UnimplementedError( 'disposeKeepAlive is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearAllCache} + ///Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used. + /// + ///[includeDiskFiles] if `false`, only the RAM cache is cleared. The default value is `true`. + /// + ///**Officially Supported Platforms/Implementations**: + ///- Android native WebView + ///- iOS + ///- MacOS + ///{@endtemplate} + Future clearAllCache({bool includeDiskFiles = true}) { + throw UnimplementedError( + 'clearAllCache is not implemented on the current platform'); + } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.tRexRunnerHtml} ///Gets the html (with javascript) of the Chromium's t-rex runner game. Used in combination with [tRexRunnerCss]. /// @@ -2221,7 +2246,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future get tRexRunnerHtml => throw UnimplementedError( 'tRexRunnerHtml is not implemented on the current platform'); @@ -2232,13 +2257,13 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///- Android native WebView ///- iOS ///- MacOS - ///@{endtemplate} + ///{@endtemplate} Future get tRexRunnerCss => throw UnimplementedError( 'tRexRunnerCss is not implemented on the current platform'); ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.setOptions} ///Use [setSettings] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated('Use setSettings instead') Future setOptions({required InAppWebViewGroupOptions options}) { throw UnimplementedError( @@ -2247,7 +2272,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getOptions} ///Use [getSettings] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated('Use getSettings instead') Future getOptions() { throw UnimplementedError( @@ -2256,7 +2281,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.findAllAsync} ///Use [PlatformFindInteractionController.findAll] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use FindInteractionController.findAll instead") Future findAllAsync({required String find}) { throw UnimplementedError( @@ -2265,7 +2290,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.findNext} ///Use [PlatformFindInteractionController.findNext] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use FindInteractionController.findNext instead") Future findNext({required bool forward}) { throw UnimplementedError( @@ -2274,7 +2299,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.clearMatches} ///Use [PlatformFindInteractionController.clearMatches] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use FindInteractionController.clearMatches instead") Future clearMatches() { throw UnimplementedError( @@ -2283,7 +2308,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getTRexRunnerHtml} ///Use [tRexRunnerHtml] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use tRexRunnerHtml instead") Future getTRexRunnerHtml() { throw UnimplementedError( @@ -2292,7 +2317,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getTRexRunnerCss} ///Use [tRexRunnerCss] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use tRexRunnerCss instead") Future getTRexRunnerCss() { throw UnimplementedError( @@ -2301,7 +2326,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getScale} ///Use [getZoomScale] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated('Use getZoomScale instead') Future getScale() { throw UnimplementedError( @@ -2310,7 +2335,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.setSafeBrowsingWhitelist} ///Use [setSafeBrowsingAllowlist] instead. - ///@{endtemplate} + ///{@endtemplate} @Deprecated("Use setSafeBrowsingAllowlist instead") Future setSafeBrowsingWhitelist({required List hosts}) { throw UnimplementedError( @@ -2319,7 +2344,7 @@ abstract class PlatformInAppWebViewController extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppWebViewController.dispose} ///Disposes the controller. - ///@{endtemplate} + ///{@endtemplate} void dispose({bool isKeepAlive = false}) { throw UnimplementedError( 'dispose is not implemented on the current platform'); diff --git a/flutter_inappwebview_platform_interface/lib/src/platform_cookie_manager.dart b/flutter_inappwebview_platform_interface/lib/src/platform_cookie_manager.dart index 8a907c93..a3e98c5e 100755 --- a/flutter_inappwebview_platform_interface/lib/src/platform_cookie_manager.dart +++ b/flutter_inappwebview_platform_interface/lib/src/platform_cookie_manager.dart @@ -176,6 +176,9 @@ abstract class PlatformCookieManager extends PlatformInterface { ///from the current context of the `WebView` managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work. ///In this case the [url] parameter is ignored. /// + ///The return value indicates whether the cookie was deleted successfully. + ///Note that it will return always `true` for Web platform, iOS below 11.0 and MacOS below 10.13. + /// ///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [PlatformHeadlessInAppWebView] ///to delete the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be deleted!). /// @@ -189,7 +192,7 @@ abstract class PlatformCookieManager extends PlatformInterface { ///- MacOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete) ///- Web ///{@endtemplate} - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -210,6 +213,9 @@ abstract class PlatformCookieManager extends PlatformInterface { ///from the current context of the `WebView` managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. JavaScript must be enabled in order to work. ///In this case the [url] parameter is ignored. /// + ///The return value indicates whether cookies were deleted successfully. + ///Note that it will return always `true` for Web platform, iOS below 11.0 and MacOS below 10.13. + /// ///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [PlatformHeadlessInAppWebView] ///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!). /// @@ -223,7 +229,7 @@ abstract class PlatformCookieManager extends PlatformInterface { ///- MacOS ///- Web ///{@endtemplate} - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -237,6 +243,9 @@ abstract class PlatformCookieManager extends PlatformInterface { ///{@template flutter_inappwebview_platform_interface.PlatformCookieManager.deleteAllCookies} ///Removes all cookies. /// + ///The return value indicates whether any cookies were removed. + ///Note that it will return always `true` for Web, iOS and MacOS platforms. + /// ///**NOTE for iOS**: available from iOS 11.0+. /// ///**NOTE for MacOS**: available from iOS 10.13+. @@ -246,7 +255,7 @@ abstract class PlatformCookieManager extends PlatformInterface { ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata)) ///- MacOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata)) ///{@endtemplate} - Future deleteAllCookies() { + Future deleteAllCookies() { throw UnimplementedError( 'deleteAllCookies is not implemented on the current platform'); } @@ -266,4 +275,17 @@ abstract class PlatformCookieManager extends PlatformInterface { throw UnimplementedError( 'getAllCookies is not implemented on the current platform'); } + + ///{@template flutter_inappwebview_platform_interface.PlatformCookieManager.removeSessionCookies} + ///Removes all session cookies, which are cookies without an expiration date. + /// + ///The return value indicates whether any cookies were removed. + /// + ///**Officially Supported Platforms/Implementations**: + ///- Android native WebView ([Official API - CookieManager.removeSessionCookies](https://developer.android.com/reference/android/webkit/CookieManager#removeSessionCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) + ///{@endtemplate} + Future removeSessionCookies() { + throw UnimplementedError( + 'removeSessionCookies is not implemented on the current platform'); + } } diff --git a/flutter_inappwebview_web/CHANGELOG.md b/flutter_inappwebview_web/CHANGELOG.md index 944174ca..a6b2f027 100644 --- a/flutter_inappwebview_web/CHANGELOG.md +++ b/flutter_inappwebview_web/CHANGELOG.md @@ -1,6 +1,7 @@ ## 1.0.4 - Updated `flutter_inappwebview_platform_interface` version dependency to `1.0.6` +- Updated `CookieManager` methods return value ## 1.0.3 diff --git a/flutter_inappwebview_web/lib/src/cookie_manager.dart b/flutter_inappwebview_web/lib/src/cookie_manager.dart index efe2302d..a173b471 100755 --- a/flutter_inappwebview_web/lib/src/cookie_manager.dart +++ b/flutter_inappwebview_web/lib/src/cookie_manager.dart @@ -241,7 +241,7 @@ class WebPlatformCookieManager extends PlatformCookieManager } @override - Future deleteCookie( + Future deleteCookie( {required WebUri url, required String name, String path = "/", @@ -262,11 +262,11 @@ class WebPlatformCookieManager extends PlatformCookieManager domain: domain, maxAge: -1, webViewController: webViewController); - return; + return true; } @override - Future deleteCookies( + Future deleteCookies( {required WebUri url, String path = "/", String? domain, @@ -289,7 +289,7 @@ class WebPlatformCookieManager extends PlatformCookieManager maxAge: -1, webViewController: webViewController); } - return; + return true; } Future _getCookieExpirationDate(int expiresDate) async {