diff --git a/dev_packages/generators/lib/src/util.dart b/dev_packages/generators/lib/src/util.dart index 1095fdad..b5bf5b40 100644 --- a/dev_packages/generators/lib/src/util.dart +++ b/dev_packages/generators/lib/src/util.dart @@ -66,11 +66,11 @@ abstract class Util { return """/// ${platformNoteList.join("\n///\n")} /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ${platformSupportedList.join("\n")}"""; } else { return """/// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ${platformSupportedList.join("\n")}"""; } } diff --git a/flutter_inappwebview_android/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/flutter_inappwebview_android/lib/src/chrome_safari_browser/chrome_safari_browser.dart index ee917f5c..fbedd340 100755 --- a/flutter_inappwebview_android/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/flutter_inappwebview_android/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -26,19 +26,10 @@ class AndroidChromeSafariBrowserCreationParams } } -///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android -///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS. -/// -///**NOTE**: If you want to use the `ChromeSafariBrowser` class on Android 11+ you need to specify your app querying for -///`android.support.customtabs.action.CustomTabsService` in your `AndroidManifest.xml` -///(you can read more about it here: https://developers.google.com/web/android/custom-tabs/best-practices#applications_targeting_android_11_api_level_30_or_above). -/// -///**Supported Platforms/Implementations**: -///- Android -///- iOS +///{@macro flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser} class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser with ChannelController { - ///View ID used internally. + @override final String id = IdGenerator.generate(); /// Constructs a [AndroidChromeSafariBrowser]. @@ -53,6 +44,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser static final AndroidChromeSafariBrowser _staticValue = AndroidChromeSafariBrowser(AndroidChromeSafariBrowserCreationParams()); + /// Provide static access. factory AndroidChromeSafariBrowser.static() { return _staticValue; } @@ -193,25 +185,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser } } - ///Opens the [AndroidChromeSafariBrowser] instance with an [url]. - /// - ///[url] - The [url] to load. On iOS, the [url] is required and must use the `http` or `https` scheme. - /// - ///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers. - ///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a - ///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started). - /// - ///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. Supported only on Android. - /// - ///[referrer] - referrer header. Supported only on Android. - /// - ///[options] - Deprecated. Use `settings` instead. - /// - ///[settings] - Settings for the [AndroidChromeSafariBrowser]. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override Future open( {WebUri? url, Map? headers, @@ -258,20 +232,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser await _staticChannel.invokeMethod('open', args); } - ///Tells the browser to launch with [url]. - /// - ///[url] - initial url. - /// - ///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers. - ///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a - ///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started). - /// - ///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. - /// - ///[referrer] - referrer header. Supported only on Android. - /// - ///**Supported Platforms/Implementations**: - ///- Android + @override Future launchUrl({ required WebUri url, Map? headers, @@ -287,18 +248,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser await channel?.invokeMethod("launchUrl", args); } - ///Tells the browser of a likely future navigation to a URL. - ///The most likely URL has to be specified first. - ///Optionally, a list of other likely URLs can be provided. - ///They are treated as less likely than the first one, and have to be sorted in decreasing priority order. - ///These additional URLs may be ignored. All previous calls to this method will be deprioritized. - /// - ///[url] - Most likely URL, may be null if otherLikelyBundles is provided. - /// - ///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E))) + @override Future mayLaunchUrl( {WebUri? url, List? otherLikelyURLs}) async { Map args = {}; @@ -308,22 +258,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser return await channel?.invokeMethod("mayLaunchUrl", args) ?? false; } - ///Requests to validate a relationship between the application and an origin. - /// - ///See [here](https://developers.google.com/digital-asset-links/v1/getting-started) for documentation about Digital Asset Links. - ///This methods requests the browser to verify a relation with the calling application, to grant the associated rights. - /// - ///If this method returns `true`, the validation result will be provided through [onRelationshipValidationResult]. - ///Otherwise the request didn't succeed. - /// - ///[relation] – Relation to check, must be one of the [CustomTabsRelationType] constants. - /// - ///[origin] – Origin. - /// - ///[extras] – Reserved for future use. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle))) + @override Future validateRelationship( {required CustomTabsRelationType relation, required WebUri origin}) async { @@ -334,32 +269,18 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser false; } - ///Closes the [AndroidChromeSafariBrowser] instance. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override Future close() async { Map args = {}; await channel?.invokeMethod("close", args); } - ///Set a custom action button. - /// - ///**NOTE**: Not available in a Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean))) + @override void setActionButton(ChromeSafariBrowserActionButton actionButton) { this._actionButton = actionButton; } - ///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description]. - /// - ///**NOTE**: Not available in a Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String))) + @override Future updateActionButton( {required Uint8List icon, required String description}) async { Map args = {}; @@ -370,23 +291,13 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser _actionButton?.description = description; } - ///Sets the remote views displayed in the secondary toolbar in a custom tab. - /// - ///**NOTE**: Not available in a Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) + @override void setSecondaryToolbar( ChromeSafariBrowserSecondaryToolbar secondaryToolbar) { this._secondaryToolbar = secondaryToolbar; } - ///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session. - /// - ///**NOTE**: Not available in a Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) + @override Future updateSecondaryToolbar( ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async { Map args = {}; @@ -395,47 +306,19 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser this._secondaryToolbar = secondaryToolbar; } - ///Adds a [ChromeSafariBrowserMenuItem] to the menu. - /// - ///**NOTE**: Not available in an Android Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override void addMenuItem(ChromeSafariBrowserMenuItem menuItem) { this._menuItems[menuItem.id] = menuItem; } - ///Adds a list of [ChromeSafariBrowserMenuItem] to the menu. - /// - ///**NOTE**: Not available in an Android Trusted Web Activity. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override void addMenuItems(List menuItems) { menuItems.forEach((menuItem) { this._menuItems[menuItem.id] = menuItem; }); } - ///Sends a request to create a two way postMessage channel between the client - ///and the browser. - ///If you want to specifying the target origin to communicate with, set the [targetOrigin]. - /// - ///[sourceOrigin] - A origin that the client is requesting to be - ///identified as during the postMessage communication. - ///It has to either start with http or https. - /// - ///[targetOrigin] - The target Origin to establish the postMessage communication with. - ///This can be the app's package name, it has to either start with http or https. - /// - ///Returns whether the implementation accepted the request. - ///Note that returning true here doesn't mean an origin has already been - ///assigned as the validation is asynchronous. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle))) + @override Future requestPostMessageChannel( {required WebUri sourceOrigin, WebUri? targetOrigin}) async { Map args = {}; @@ -446,16 +329,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser false; } - ///Sends a postMessage request using the origin communicated via [requestPostMessageChannel]. - ///Fails when called before [onMessageChannelReady] event. - /// - ///[message] – The message that is being sent. - /// - ///Returns an integer constant about the postMessage request result. - ///Will return CustomTabsService.RESULT_SUCCESS if successful. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle))) + @override Future postMessage(String message) async { Map args = {}; args.putIfAbsent("message", () => message); @@ -464,15 +338,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR; } - ///Returns whether the Engagement Signals API is available. - ///The availability of the Engagement Signals API may change at runtime. - ///If an EngagementSignalsCallback has been set, an [onSessionEnded] - ///signal will be sent if the API becomes unavailable later. - /// - ///Returns whether the Engagement Signals API is available. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle))) + @override Future isEngagementSignalsApiAvailable() async { Map args = {}; return await channel?.invokeMethod( @@ -480,45 +346,21 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser false; } - ///On Android, returns `true` if Chrome Custom Tabs is available. - ///On iOS, returns `true` if SFSafariViewController is available. - ///Otherwise returns `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override Future isAvailable() async { Map args = {}; return await _staticChannel.invokeMethod("isAvailable", args) ?? false; } - ///The maximum number of allowed secondary toolbar items. - /// - ///**Supported Platforms/Implementations**: - ///- Android + @override Future getMaxToolbarItems() async { Map args = {}; return await _staticChannel.invokeMethod("getMaxToolbarItems", args) ?? 0; } - ///Returns the preferred package to use for Custom Tabs. - ///The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs. - ///To modify this preferred behavior, set [ignoreDefault] to `true` and give a - ///non empty list of package names in packages. - ///This method queries the `PackageManager` to determine which packages support the Custom Tabs API. - ///On apps that target Android 11 and above, this requires adding the following - ///package visibility elements to your manifest. - /// - ///[packages] – Ordered list of packages to test for Custom Tabs support, in decreasing order of priority. - /// - ///[ignoreDefault] – If set, the default VIEW handler won't get priority over other browsers. - /// - ///Returns the preferred package name for handling Custom Tabs, or null. - /// - ///**Supported Platforms/Implementations**: - ///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean)))) + @override Future getPackageName( {List? packages, bool ignoreDefault = false}) async { Map args = {}; @@ -527,38 +369,13 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser return await _staticChannel.invokeMethod("getPackageName", args); } - ///Clear associated website data accrued from browsing activity within your app. - ///This includes all local storage, cached resources, and cookies. - /// - ///**NOTE for iOS**: available on iOS 16.0+. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata)) + @override Future clearWebsiteData() async { Map args = {}; await _staticChannel.invokeMethod("clearWebsiteData", args); } - ///Prewarms a connection to each URL. SFSafariViewController will automatically use a - ///prewarmed connection if possible when loading its initial URL. - /// - ///Returns a token object that corresponds to the requested URLs. You must keep a strong - ///reference to this token as long as you expect the prewarmed connections to remain open. If the same - ///server is requested in multiple calls to this method, all of the corresponding tokens must be - ///invalidated or released to end the prewarmed connection to that server. - /// - ///This method uses a best-effort approach to prewarming connections, but may delay - ///or drop requests based on the volume of requests made by your app. Use this method when you expect - ///to present the browser soon. Many HTTP servers time out connections after a few minutes. - ///After a timeout, prewarming delivers less performance benefit. - /// - ///[URLs] - the URLs of servers that the browser should prewarm connections to. - ///Only supports URLs with `http://` or `https://` schemes. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) + @override Future prewarmConnections(List URLs) async { Map args = {}; args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList()); @@ -568,12 +385,7 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser return PrewarmingToken.fromMap(result); } - ///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) + @override Future invalidatePrewarmingToken( PrewarmingToken prewarmingToken) async { Map args = {}; @@ -581,16 +393,11 @@ class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser await _staticChannel.invokeMethod("invalidatePrewarmingToken", args); } - ///Returns `true` if the [AndroidChromeSafariBrowser] instance is opened, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS + @override bool isOpened() { return _isOpened; } - ///Disposes the channel. @override @mustCallSuper void dispose() { diff --git a/flutter_inappwebview_android/lib/src/cookie_manager.dart b/flutter_inappwebview_android/lib/src/cookie_manager.dart index df88449c..1bef4439 100755 --- a/flutter_inappwebview_android/lib/src/cookie_manager.dart +++ b/flutter_inappwebview_android/lib/src/cookie_manager.dart @@ -30,19 +30,7 @@ class AndroidCookieManagerCreationParams } } -///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances. -///On Android, it is implemented using [CookieManager](https://developer.android.com/reference/android/webkit/CookieManager). -///On iOS, it is implemented using [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore). -/// -///**NOTE for iOS below 11.0 and Web platform (LIMITED SUPPORT!)**: in this case, almost all of the methods ([AndroidCookieManager.deleteAllCookies] and [AndroidCookieManager.getAllCookies] are not supported!) -///has been implemented using JavaScript because there is no other way to work with them on iOS below 11.0. -///See https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies for JavaScript restrictions. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS -///- Web +///{@macro flutter_inappwebview_platform_interface.PlatformCookieManager} class AndroidCookieManager extends PlatformCookieManager with ChannelController { /// Creates a new [AndroidCookieManager]. @@ -74,29 +62,6 @@ class AndroidCookieManager extends PlatformCookieManager Future _handleMethod(MethodCall call) async {} - ///Sets a cookie for the given [url]. Any existing cookie with the same [host], [path] and [name] will be replaced with the new cookie. - ///The cookie being set will be ignored if it is expired. - /// - ///The default value of [path] is `"/"`. - /// - ///[webViewController] could be used if you need to set a session-only cookie using JavaScript (so [isHttpOnly] cannot be set, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) - ///on the current URL of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. In this case the [url] parameter is ignored. - /// - ///The return value indicates whether the cookie was set 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 [AndroidHeadlessInAppWebView] - ///to set the cookie (session-only cookie won't work! In that case, you should set also [expiresDate] or [maxAge]). - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to set the cookie (session-only cookie won't work! In that case, you should set also [expiresDate] or [maxAge]). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - CookieManager.setCookie](https://developer.android.com/reference/android/webkit/CookieManager#setCookie(java.lang.String,%20java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) - ///- iOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie)) - ///- MacOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie)) - ///- Web @override Future setCookie( {required WebUri url, @@ -200,25 +165,6 @@ class AndroidCookieManager extends PlatformCookieManager await headlessWebView.dispose(); } - ///Gets all the cookies for the given [url]. - /// - ///[webViewController] is used for getting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) - ///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. - /// - ///**NOTE for iOS below 11.0 and MacOS below 10.13**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value]. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!). - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - CookieManager.getCookie](https://developer.android.com/reference/android/webkit/CookieManager#getCookie(java.lang.String))) - ///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) - ///- MacOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) - ///- Web @override Future> getCookies( {required WebUri url, @@ -316,25 +262,6 @@ class AndroidCookieManager extends PlatformCookieManager return cookies; } - ///Gets a cookie by its [name] for the given [url]. - /// - ///[webViewController] is used for getting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be found, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) - ///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. - /// - ///**NOTE for iOS below 11.0 and MacOS below 10.13**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value]. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!). - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web @override Future getCookie( {required WebUri url, @@ -378,26 +305,6 @@ class AndroidCookieManager extends PlatformCookieManager return null; } - ///Removes a cookie by its [name] for the given [url], [domain] and [path]. - /// - ///The default value of [path] is `"/"`. - /// - ///[webViewController] is used for deleting the cookie (also session-only cookie) using JavaScript (cookie with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) - ///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. - /// - ///**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 [AndroidHeadlessInAppWebView] - ///to delete the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be deleted!). - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to delete the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be deleted!). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete) - ///- MacOS ([Official API - WKHTTPCookieStore.delete](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete) - ///- Web @override Future deleteCookie( {required WebUri url, @@ -432,26 +339,6 @@ class AndroidCookieManager extends PlatformCookieManager await channel?.invokeMethod('deleteCookie', args); } - ///Removes all cookies for the given [url], [domain] and [path]. - /// - ///The default value of [path] is `"/"`. - /// - ///[webViewController] is used for deleting the cookies (also session-only cookies) using JavaScript (cookies with `isHttpOnly` enabled cannot be deleted, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) - ///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. - /// - ///**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 [AndroidHeadlessInAppWebView] - ///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!). - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - ///If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [AndroidHeadlessInAppWebView] - ///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web @override Future deleteCookies( {required WebUri url, @@ -487,31 +374,12 @@ class AndroidCookieManager extends PlatformCookieManager await channel?.invokeMethod('deleteCookies', args); } - ///Removes all cookies. - /// - ///**NOTE for iOS**: available from iOS 11.0+. - /// - ///**NOTE for MacOS**: available from iOS 10.13+. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - CookieManager.removeAllCookies](https://developer.android.com/reference/android/webkit/CookieManager#removeAllCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E))) - ///- 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)) @override Future deleteAllCookies() async { Map args = {}; await channel?.invokeMethod('deleteAllCookies', args); } - ///Fetches all stored cookies. - /// - ///**NOTE for iOS**: available on iOS 11.0+. - /// - ///**NOTE for MacOS**: available from iOS 10.13+. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) - ///- MacOS ([Official API - WKHTTPCookieStore.getAllCookies](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882005-getallcookies)) @override Future> getAllCookies() async { List cookies = []; diff --git a/flutter_inappwebview_android/lib/src/find_interaction/find_interaction_controller.dart b/flutter_inappwebview_android/lib/src/find_interaction/find_interaction_controller.dart index 3c443f8c..da8c12b1 100644 --- a/flutter_inappwebview_android/lib/src/find_interaction/find_interaction_controller.dart +++ b/flutter_inappwebview_android/lib/src/find_interaction/find_interaction_controller.dart @@ -24,10 +24,7 @@ class AndroidFindInteractionControllerCreationParams } } -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController} class AndroidFindInteractionController extends PlatformFindInteractionController with ChannelController { /// Constructs a [AndroidFindInteractionController]. @@ -68,138 +65,64 @@ class AndroidFindInteractionController extends PlatformFindInteractionController return null; } - ///Finds all instances of find on the page and highlights them. Notifies [AndroidFindInteractionController.onFindResultReceived] listener. - /// - ///[find] represents the string to find. - /// - ///**NOTE**: on Android native WebView, it finds all instances asynchronously. Successive calls to this will cancel any pending searches. - /// - ///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`, - ///it uses the built-in find interaction native UI, - ///otherwise this is implemented using CSS and Javascript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.findAllAsync](https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String))) - ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2) with [Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.findAll} Future findAll({String? find}) async { Map args = {}; args.putIfAbsent('find', () => find); await channel?.invokeMethod('findAll', args); } - ///Highlights and scrolls to the next match found by [findAll]. Notifies [AndroidFindInteractionController.onFindResultReceived] listener. - /// - ///[forward] represents the direction to search. The default value is `true`, meaning forward. - /// - ///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`, - ///it uses the built-in find interaction native UI, - ///otherwise this is implemented using CSS and Javascript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.findNext](https://developer.android.com/reference/android/webkit/WebView#findNext(boolean))) - ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.findNext](https://developer.apple.com/documentation/uikit/uifindinteraction/3975829-findnext?changes=_2) and ([Official API - UIFindInteraction.findPrevious](https://developer.apple.com/documentation/uikit/uifindinteraction/3975830-findprevious?changes=_2))) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.findNext} Future findNext({bool forward = true}) async { Map args = {}; args.putIfAbsent('forward', () => forward); await channel?.invokeMethod('findNext', args); } - ///Clears the highlighting surrounding text matches created by [findAll]. - /// - ///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`, - ///it uses the built-in find interaction native UI, - ///otherwise this is implemented using CSS and Javascript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.clearMatches](https://developer.android.com/reference/android/webkit/WebView#clearMatches())) - ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2)) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.clearMatches} Future clearMatches() async { Map args = {}; await channel?.invokeMethod('clearMatches', args); } - ///Pre-populate the search text to be used. - /// - ///On iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true, - ///it will pre-populate the system find panel's search text field with a search query. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.setSearchText} Future setSearchText(String? searchText) async { Map args = {}; args.putIfAbsent('searchText', () => searchText); await channel?.invokeMethod('setSearchText', args); } - ///Get the search text used. - /// - ///On iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true, - ///it will get the system find panel's search text field value. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getSearchText} Future getSearchText() async { Map args = {}; return await channel?.invokeMethod('getSearchText', args); } - ///A Boolean value that indicates when the find panel displays onscreen. - /// - ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - UIFindInteraction.isFindNavigatorVisible](https://developer.apple.com/documentation/uikit/uifindinteraction/3975828-isfindnavigatorvisible?changes=_2)) + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.isFindNavigatorVisible} Future isFindNavigatorVisible() async { Map args = {}; return await channel?.invokeMethod('isFindNavigatorVisible', args); } - ///Updates the results the interface displays for the active search. - /// - ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - UIFindInteraction.updateResultCount](https://developer.apple.com/documentation/uikit/uifindinteraction/3975835-updateresultcount?changes=_2)) + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.updateResultCount} Future updateResultCount() async { Map args = {}; await channel?.invokeMethod('updateResultCount', args); } - ///Begins a search, displaying the find panel. - /// - ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2)) + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.presentFindNavigator} Future presentFindNavigator() async { Map args = {}; await channel?.invokeMethod('presentFindNavigator', args); } - ///Dismisses the find panel, if present. - /// - ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2)) + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.dismissFindNavigator} Future dismissFindNavigator() async { Map args = {}; await channel?.invokeMethod('dismissFindNavigator', args); } - ///If there's a currently active find session, returns the active find session. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - UIFindInteraction.activeFindSession](https://developer.apple.com/documentation/uikit/uifindinteraction/3975825-activefindsession?changes=_7____4_8&language=objc)) - ///- MacOS + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.getActiveFindSession} Future getActiveFindSession() async { Map args = {}; Map? result = @@ -208,7 +131,7 @@ class AndroidFindInteractionController extends PlatformFindInteractionController return FindSession.fromMap(result); } - ///Disposes the controller. + ///{@macro flutter_inappwebview_platform_interface.PlatformFindInteractionController.dispose} @override void dispose({bool isKeepAlive = false}) { disposeChannel(removeMethodCallHandler: !isKeepAlive); diff --git a/flutter_inappwebview_android/lib/src/http_auth_credentials_database.dart b/flutter_inappwebview_android/lib/src/http_auth_credentials_database.dart index 49cddf60..06ec37ac 100755 --- a/flutter_inappwebview_android/lib/src/http_auth_credentials_database.dart +++ b/flutter_inappwebview_android/lib/src/http_auth_credentials_database.dart @@ -25,16 +25,7 @@ class AndroidHttpAuthCredentialDatabaseCreationParams } } -///Class that implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache. -///On iOS and MacOS, this class uses the [URLCredentialStorage](https://developer.apple.com/documentation/foundation/urlcredentialstorage) class. -///On Android, this class has a custom implementation using `android.database.sqlite.SQLiteDatabase` because -///[WebViewDatabase](https://developer.android.com/reference/android/webkit/WebViewDatabase) -///doesn't offer the same functionalities as iOS `URLCredentialStorage`. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformHttpAuthCredentialDatabase} class AndroidHttpAuthCredentialDatabase extends PlatformHttpAuthCredentialDatabase with ChannelController { /// Creates a new [AndroidHttpAuthCredentialDatabase]. @@ -68,14 +59,7 @@ class AndroidHttpAuthCredentialDatabase Future _handleMethod(MethodCall call) async {} - ///Gets a map list of all HTTP auth credentials saved. - ///Each map contains the key `protectionSpace` of type [URLProtectionSpace] - ///and the key `credentials` of type List<[URLCredential]> that contains all the HTTP auth credentials saved for that `protectionSpace`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - URLCredentialStorage.allCredentials](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1413859-allcredentials)) - ///- MacOS ([Official API - URLCredentialStorage.allCredentials](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1413859-allcredentials)) + @override Future> getAllAuthCredentials() async { Map args = {}; @@ -94,12 +78,7 @@ class AndroidHttpAuthCredentialDatabase return result; } - ///Gets all the HTTP auth credentials saved for that [protectionSpace]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future> getHttpAuthCredentials( {required URLProtectionSpace protectionSpace}) async { Map args = {}; @@ -119,12 +98,7 @@ class AndroidHttpAuthCredentialDatabase return credentials; } - ///Saves an HTTP auth [credential] for that [protectionSpace]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - URLCredentialStorage.set](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1407227-set)) - ///- MacOS ([Official API - URLCredentialStorage.set](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1407227-set)) + @override Future setHttpAuthCredential( {required URLProtectionSpace protectionSpace, required URLCredential credential}) async { @@ -138,12 +112,7 @@ class AndroidHttpAuthCredentialDatabase await channel?.invokeMethod('setHttpAuthCredential', args); } - ///Removes an HTTP auth [credential] for that [protectionSpace]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - URLCredentialStorage.remove](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1408664-remove)) - ///- MacOS ([Official API - URLCredentialStorage.remove](https://developer.apple.com/documentation/foundation/urlcredentialstorage/1408664-remove)) + @override Future removeHttpAuthCredential( {required URLProtectionSpace protectionSpace, required URLCredential credential}) async { @@ -157,12 +126,7 @@ class AndroidHttpAuthCredentialDatabase await channel?.invokeMethod('removeHttpAuthCredential', args); } - ///Removes all the HTTP auth credentials saved for that [protectionSpace]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future removeHttpAuthCredentials( {required URLProtectionSpace protectionSpace}) async { Map args = {}; @@ -173,12 +137,7 @@ class AndroidHttpAuthCredentialDatabase await channel?.invokeMethod('removeHttpAuthCredentials', args); } - ///Removes all the HTTP auth credentials saved in the database. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future clearAllAuthCredentials() async { Map args = {}; await channel?.invokeMethod('clearAllAuthCredentials', args); diff --git a/flutter_inappwebview_android/lib/src/in_app_browser/in_app_browser.dart b/flutter_inappwebview_android/lib/src/in_app_browser/in_app_browser.dart index 084c55a5..0b8cafd4 100755 --- a/flutter_inappwebview_android/lib/src/in_app_browser/in_app_browser.dart +++ b/flutter_inappwebview_android/lib/src/in_app_browser/in_app_browser.dart @@ -46,15 +46,9 @@ class AndroidInAppBrowserCreationParams final AndroidPullToRefreshController? pullToRefreshController; } -///This class uses the native WebView of the platform. -///The [webViewController] field can be used to access the [InAppWebViewController] API. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformInAppBrowser} class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { - ///View ID used internally. + @override final String id = IdGenerator.generate(); /// Constructs a [AndroidInAppBrowser]. @@ -71,6 +65,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { static final AndroidInAppBrowser _staticValue = AndroidInAppBrowser(AndroidInAppBrowserCreationParams()); + /// Provide static access. factory AndroidInAppBrowser.static() { return _staticValue; } @@ -83,14 +78,14 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { ContextMenu? _contextMenu; + @override ContextMenu? get contextMenu => _contextMenu; Map _menuItems = HashMap(); bool _isOpened = false; AndroidInAppWebViewController? _webViewController; - ///WebView Controller that can be used to access the [AndroidInAppWebViewController] API. - ///When [onExit] is fired, this will be `null` and cannot be used anymore. + @override AndroidInAppWebViewController? get webViewController { return _isOpened ? _webViewController : null; } @@ -177,18 +172,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { return args; } - ///Opens the [PlatformInAppBrowser] instance with an [urlRequest]. - /// - ///[urlRequest]: The [urlRequest] to load. - /// - ///[options]: Options for the [PlatformInAppBrowser]. - /// - ///[settings]: Settings for the [PlatformInAppBrowser]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future openUrlRequest( {required URLRequest urlRequest, // ignore: deprecated_member_use_from_same_package @@ -202,48 +186,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await _staticChannel.invokeMethod('open', args); } - ///Opens the [PlatformInAppBrowser] instance with the given [assetFilePath] file. - /// - ///[options]: Options for the [PlatformInAppBrowser]. - /// - ///To be able to load your local files (assets, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found! - /// - ///Example of a `pubspec.yaml` file: - ///```yaml - ///... - /// - ///# The following section is specific to Flutter. - ///flutter: - /// - /// # The following line ensures that the Material Icons font is - /// # included with your application, so that you can use the icons in - /// # the material Icons class. - /// uses-material-design: true - /// - /// assets: - /// - assets/index.html - /// - assets/css/ - /// - assets/images/ - /// - ///... - ///``` - ///Example of a `main.dart` file: - ///```dart - ///... - ///inAppBrowser.openFile(assetFilePath: "assets/index.html"); - ///... - ///``` - /// - ///[headers]: The additional headers to be used in the HTTP request for this URL, specified as a map from name to value. - /// - ///[options]: Options for the [PlatformInAppBrowser]. - /// - ///[settings]: Settings for the [PlatformInAppBrowser]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future openFile( {required String assetFilePath, // ignore: deprecated_member_use_from_same_package @@ -257,22 +200,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await _staticChannel.invokeMethod('open', args); } - ///Opens the [PlatformInAppBrowser] instance with [data] as a content, using [baseUrl] as the base URL for it. - /// - ///The [mimeType] parameter specifies the format of the data. The default value is `"text/html"`. - /// - ///The [encoding] parameter specifies the encoding of the data. The default value is `"utf8"`. - /// - ///The [androidHistoryUrl] parameter is the URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. This parameter is used only on Android. - /// - ///The [options] parameter specifies the options for the [PlatformInAppBrowser]. - /// - ///[settings]: Settings for the [PlatformInAppBrowser]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future openData( {required String data, String mimeType = "text/html", @@ -294,12 +222,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await _staticChannel.invokeMethod('open', args); } - ///This is a static method that opens an [url] in the system browser. You wont be able to use the [PlatformInAppBrowser] methods here! - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future openWithSystemBrowser({required WebUri url}) async { assert(url.toString().isNotEmpty); @@ -308,81 +231,41 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { return await _staticChannel.invokeMethod('openWithSystemBrowser', args); } - ///Adds a [InAppBrowserMenuItem] to the menu. - ///If the browser is already open, - ///it will take effect the next time it is opened. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS 14.0+ + @override void addMenuItem(InAppBrowserMenuItem menuItem) { _menuItems[menuItem.id] = menuItem; } - ///Adds a list of [InAppBrowserMenuItem] to the menu. - ///If the browser is already open, - ///it will take effect the next time it is opened. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS 14.0+ + @override void addMenuItems(List menuItems) { menuItems.forEach((menuItem) { _menuItems[menuItem.id] = menuItem; }); } - ///Removes the [menuItem] from the list. - ///Returns `true` if it was in the list, `false` otherwise. - ///If the browser is already open, - ///it will take effect the next time it is opened. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS 14.0+ + @override bool removeMenuItem(InAppBrowserMenuItem menuItem) { return _menuItems.remove(menuItem.id) != null; } - ///Removes a list of [menuItems] from the list. - ///If the browser is already open, - ///it will take effect the next time it is opened. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS 14.0+ + @override void removeMenuItems(List menuItems) { for (final menuItem in menuItems) { removeMenuItem(menuItem); } } - ///Removes all the menu items from the list. - ///If the browser is already open, - ///it will take effect the next time it is opened. - /// - ///**Supported Platforms/Implementations**: - ///- Android - ///- iOS 14.0+ + @override void removeAllMenuItem() { _menuItems.clear(); } - ///Returns `true` if the [menuItem] has been already added, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS 14.0+ + @override bool hasMenuItem(InAppBrowserMenuItem menuItem) { return _menuItems.containsKey(menuItem.id); } - ///Displays an [PlatformInAppBrowser] window that was opened hidden. Calling this has no effect if the [PlatformInAppBrowser] was already visible. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future show() async { assert(_isOpened, 'The browser is not opened.'); @@ -390,12 +273,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await channel?.invokeMethod('show', args); } - ///Hides the [PlatformInAppBrowser] window. Calling this has no effect if the [PlatformInAppBrowser] was already hidden. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future hide() async { assert(_isOpened, 'The browser is not opened.'); @@ -403,12 +281,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await channel?.invokeMethod('hide', args); } - ///Closes the [PlatformInAppBrowser] window. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future close() async { assert(_isOpened, 'The browser is not opened.'); @@ -416,12 +289,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await channel?.invokeMethod('close', args); } - ///Check if the Web View of the [PlatformInAppBrowser] instance is hidden. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future isHidden() async { assert(_isOpened, 'The browser is not opened.'); @@ -429,7 +297,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { return await channel?.invokeMethod('isHidden', args) ?? false; } - ///Use [setSettings] instead. + @override @Deprecated('Use setSettings instead') Future setOptions({required InAppBrowserClassOptions options}) async { assert(_isOpened, 'The browser is not opened.'); @@ -439,7 +307,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await channel?.invokeMethod('setSettings', args); } - ///Use [getSettings] instead. + @override @Deprecated('Use getSettings instead') Future getOptions() async { assert(_isOpened, 'The browser is not opened.'); @@ -455,12 +323,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { return null; } - ///Sets the [PlatformInAppBrowser] settings with the new [settings] and evaluates them. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future setSettings( {required InAppBrowserClassSettings settings}) async { assert(_isOpened, 'The browser is not opened.'); @@ -470,12 +333,7 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { await channel?.invokeMethod('setSettings', args); } - ///Gets the current [PlatformInAppBrowser] settings. Returns `null` if it wasn't able to get them. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future getSettings() async { assert(_isOpened, 'The browser is not opened.'); @@ -492,17 +350,11 @@ class AndroidInAppBrowser extends PlatformInAppBrowser with ChannelController { return null; } - ///Returns `true` if the [PlatformInAppBrowser] instance is opened, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override bool isOpened() { return this._isOpened; } - ///Disposes the channel and controllers. @override @mustCallSuper void dispose() { diff --git a/flutter_inappwebview_android/lib/src/in_app_webview/headless_in_app_webview.dart b/flutter_inappwebview_android/lib/src/in_app_webview/headless_in_app_webview.dart index 4d33d475..40815efc 100644 --- a/flutter_inappwebview_android/lib/src/in_app_webview/headless_in_app_webview.dart +++ b/flutter_inappwebview_android/lib/src/in_app_webview/headless_in_app_webview.dart @@ -249,21 +249,9 @@ class AndroidHeadlessInAppWebViewCreationParams final AndroidPullToRefreshController? pullToRefreshController; } -///{@template flutter_inappwebview.HeadlessInAppWebView} -///Class that represents a WebView in headless mode. -///It can be used to run a WebView in background without attaching an `InAppWebView` to the widget tree. -/// -///**NOTE**: Remember to dispose it when you don't need it anymore. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- Web -///- MacOS -///{@endtemplate} +///{@macro flutter_inappwebview_platform_interface.PlatformHeadlessInAppWebView} class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView with ChannelController { - ///View ID. @override late final String id; @@ -286,7 +274,6 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView id = IdGenerator.generate(); } - ///WebView Controller that can be used to access the [InAppWebViewController] API. @override AndroidInAppWebViewController? get webViewController => _webViewController; @@ -324,15 +311,6 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView return null; } - ///Runs the headless WebView. - /// - ///**NOTE for Web**: it will append a new `iframe` to the body. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web - ///- MacOS Future run() async { if (_started) { return; @@ -408,32 +386,11 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView } } - ///Indicates if the headless WebView is running or not. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web - ///- MacOS @override bool isRunning() { return _running; } - ///Set the size of the WebView in pixels. - /// - ///Set `-1` to match the corresponding width or height of the current device screen size. - ///`Size(-1, -1)` will match both width and height of the current device screen size. - /// - ///Note that if the [AndroidHeadlessInAppWebView] is not running, this method won't have effect. - /// - ///**NOTE for Android**: `Size` width and height values will be converted to `int` values because they cannot have `double` values. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web - ///- MacOS @override Future setSize(Size size) async { if (!_running) { @@ -445,15 +402,6 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView await channel?.invokeMethod('setSize', args); } - ///Gets the current size in pixels of the WebView. - /// - ///Note that if the [AndroidHeadlessInAppWebView] is not running, this method will return `null`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web - ///- MacOS @override Future getSize() async { if (!_running) { @@ -466,13 +414,6 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView return MapSize.fromMap(sizeMap); } - ///Disposes the headless WebView. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web - ///- MacOS @override Future dispose() async { if (!_running) { diff --git a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview.dart b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview.dart index 367d41b4..8a6b711d 100755 --- a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview.dart +++ b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview.dart @@ -475,7 +475,7 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget { @override T controllerFromPlatform(PlatformInAppWebViewController controller) { - // TODO: implement controllerFromPlatform + // unused throw UnimplementedError(); } } 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 1596e315..3034d7e3 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 @@ -19,7 +19,6 @@ import 'headless_in_app_webview.dart'; import '_static_channel.dart'; import '../print_job/main.dart'; -import '../find_interaction/main.dart'; ///List of forbidden names for JavaScript handlers. // ignore: non_constant_identifier_names @@ -89,7 +88,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController dynamic _controllerFromPlatform; - ///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`. + @override late AndroidWebStorage webStorage; AndroidInAppWebViewController( @@ -1554,60 +1553,26 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return null; } - ///Gets the URL for the current page. - ///This is not always the same as the URL passed to [WebView.onLoadStart] because although the load for that URL has begun, the current page may not have changed. - /// - ///**NOTE for Web**: If `window.location.href` isn't accessible inside the iframe, - ///it will return the current value of the `iframe.src` attribute. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getUrl](https://developer.android.com/reference/android/webkit/WebView#getUrl())) - ///- iOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url)) - ///- MacOS ([Official API - WKWebView.url](https://developer.apple.com/documentation/webkit/wkwebview/1415005-url)) - ///- Web + @override Future getUrl() async { Map args = {}; String? url = await channel?.invokeMethod('getUrl', args); return url != null ? WebUri(url) : null; } - ///Gets the title for the current page. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getTitle](https://developer.android.com/reference/android/webkit/WebView#getTitle())) - ///- iOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title)) - ///- MacOS ([Official API - WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title)) - ///- Web + @override Future getTitle() async { Map args = {}; return await channel?.invokeMethod('getTitle', args); } - ///Gets the progress for the current page. The progress value is between 0 and 100. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future getProgress() async { Map args = {}; return await channel?.invokeMethod('getProgress', args); } - ///Gets the content html of the page. It first tries to get the content through javascript. - ///If this doesn't work, it tries to get the content reading the file: - ///- checking if it is an asset (`file:///`) or - ///- downloading it using an `HttpClient` through the WebView's current url. - /// - ///Returns `null` if it was unable to get it. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future getHtml() async { String? html; @@ -1644,15 +1609,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return html; } - ///Gets the list of all favicons for the current page. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future> getFavicons() async { List favicons = []; @@ -1819,25 +1776,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return favicons; } - ///Loads the given [urlRequest]. - /// - ///- [allowingReadAccessTo], used in combination with [urlRequest] (using the `file://` scheme), - ///it represents the URL from which to read the web content. - ///This URL must be a file-based URL (using the `file://` scheme). - ///Specify the same value as the URL parameter to prevent WebView from reading any other content. - ///Specify a directory to give WebView permission to read additional files in the specified directory. - ///**NOTE**: available only on iOS and MacOS. - /// - ///**NOTE for Android**: when loading an URL Request using "POST" method, headers are ignored. - /// - ///**NOTE for Web**: if method is "GET" and headers are empty, it will change the `src` of the iframe. - ///For all other cases it will try to create an XMLHttpRequest and load the result inside the iframe. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))). If method is "POST", [Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])) - ///- 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 + @override Future loadUrl( {required URLRequest urlRequest, @Deprecated('Use allowingReadAccessTo instead') @@ -1859,21 +1798,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('loadUrl', args); } - ///Loads the given [url] with [postData] (x-www-form-urlencoded) using `POST` method into this WebView. - /// - ///Example: - ///```dart - ///var postData = Uint8List.fromList(utf8.encode("firstname=Foo&surname=Bar")); - ///controller.postUrl(url: WebUri("https://www.example.com/"), postData: postData); - ///``` - /// - ///**NOTE for Web**: it will try to create an XMLHttpRequest and load the result inside the iframe. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[]))) - ///- iOS - ///- MacOS - ///- Web + @override Future postUrl( {required WebUri url, required Uint8List postData}) async { assert(url.toString().isNotEmpty); @@ -1883,25 +1808,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('postUrl', args); } - ///Loads the given [data] into this WebView, using [baseUrl] as the base URL for the content. - /// - ///- [mimeType] argument specifies the format of the data. The default value is `"text/html"`. - ///- [encoding] argument specifies the encoding of the data. The default value is `"utf8"`. - ///**NOTE**: not used on Web. - ///- [historyUrl] is an Android-specific argument that represents the URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. - ///**NOTE**: not used on Web. - ///- [allowingReadAccessTo], used in combination with [baseUrl] (using the `file://` scheme), - ///it represents the URL from which to read the web content. - ///This [baseUrl] must be a file-based URL (using the `file://` scheme). - ///Specify the same value as the [baseUrl] parameter to prevent WebView from reading any other content. - ///Specify a directory to give WebView permission to read additional files in the specified directory. - ///**NOTE**: available only on iOS and MacOS. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.loadDataWithBaseURL](https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String))) - ///- 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 + @override Future loadData( {required String data, String mimeType = "text/html", @@ -1936,41 +1843,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('loadData', args); } - ///Loads the given [assetFilePath]. - /// - ///To be able to load your local files (assets, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found! - /// - ///Example of a `pubspec.yaml` file: - ///```yaml - ///... - /// - ///# The following section is specific to Flutter. - ///flutter: - /// - /// # The following line ensures that the Material Icons font is - /// # included with your application, so that you can use the icons in - /// # the material Icons class. - /// uses-material-design: true - /// - /// assets: - /// - assets/index.html - /// - assets/css/ - /// - assets/images/ - /// - ///... - ///``` - ///Example: - ///```dart - ///... - ///controller.loadFile(assetFilePath: "assets/index.html"); - ///... - ///``` - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))) - ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load)) - ///- MacOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load)) - ///- Web + @override Future loadFile({required String assetFilePath}) async { assert(assetFilePath.isNotEmpty); Map args = {}; @@ -1978,91 +1851,44 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('loadFile', args); } - ///Reloads the WebView. - /// - ///**NOTE for Web**: if `window.location.reload()` is not accessible inside the iframe, it will reload using the iframe `src` attribute. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.reload](https://developer.android.com/reference/android/webkit/WebView#reload())) - ///- iOS ([Official API - WKWebView.reload](https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload)) - ///- 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)) + @override Future reload() async { Map args = {}; await channel?.invokeMethod('reload', args); } - ///Goes back in the history of the WebView. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.goBack](https://developer.android.com/reference/android/webkit/WebView#goBack())) - ///- iOS ([Official API - WKWebView.goBack](https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback)) - ///- 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)) + @override Future goBack() async { Map args = {}; await channel?.invokeMethod('goBack', args); } - ///Returns a boolean value indicating whether the WebView can move backward. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future canGoBack() async { Map args = {}; return await channel?.invokeMethod('canGoBack', args) ?? false; } - ///Goes forward in the history of the WebView. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.goForward](https://developer.android.com/reference/android/webkit/WebView#goForward())) - ///- iOS ([Official API - WKWebView.goForward](https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward)) - ///- 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)) + @override Future goForward() async { Map args = {}; await channel?.invokeMethod('goForward', args); } - ///Returns a boolean value indicating whether the WebView can move forward. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future canGoForward() async { Map args = {}; return await channel?.invokeMethod('canGoForward', args) ?? false; } - ///Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.goBackOrForward](https://developer.android.com/reference/android/webkit/WebView#goBackOrForward(int))) - ///- iOS ([Official API - WKWebView.go](https://developer.apple.com/documentation/webkit/wkwebview/1414991-go)) - ///- 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)) + @override Future goBackOrForward({required int steps}) async { Map args = {}; args.putIfAbsent('steps', () => steps); await channel?.invokeMethod('goBackOrForward', args); } - ///Returns a boolean value indicating whether the WebView can go back or forward the given number of steps. Steps is negative if backward and positive if forward. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.canGoBackOrForward](https://developer.android.com/reference/android/webkit/WebView#canGoBackOrForward(int))) - ///- iOS - ///- MacOS + @override Future canGoBackOrForward({required int steps}) async { Map args = {}; args.putIfAbsent('steps', () => steps); @@ -2070,15 +1896,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///Navigates to a [WebHistoryItem] from the back-forward [WebHistory.list] and sets it as the current item. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future goTo({required WebHistoryItem historyItem}) async { var steps = historyItem.offset; if (steps != null) { @@ -2086,54 +1904,19 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController } } - ///Check if the WebView instance is in a loading state. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future isLoading() async { Map args = {}; return await channel?.invokeMethod('isLoading', args) ?? false; } - ///Stops the WebView from loading. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.stopLoading](https://developer.android.com/reference/android/webkit/WebView#stopLoading())) - ///- iOS ([Official API - WKWebView.stopLoading](https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading)) - ///- 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)) + @override Future stopLoading() async { Map args = {}; await channel?.invokeMethod('stopLoading', args); } - ///Evaluates JavaScript [source] code into the WebView and returns the result of the evaluation. - /// - ///[contentWorld], on iOS, it represents the namespace in which to evaluate the JavaScript [source] code. - ///Instead, on Android, it will run the [source] code into an iframe, using `eval(source);` to get and return the result. - ///This parameter doesn’t apply to changes you make to the underlying web content, such as the document’s DOM structure. - ///Those changes remain visible to all scripts, regardless of which content world you specify. - ///For more information about content worlds, see [ContentWorld]. - ///Available on iOS 14.0+ and MacOS 11.0+. - ///**NOTE**: not used on Web. - /// - ///**NOTE**: This method shouldn't be called in the [WebView.onWebViewCreated] or [WebView.onLoadStart] events, - ///because, in these events, the [WebView] is not ready to handle it yet. - ///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events - ///where you know the page is ready "enough". - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.evaluateJavascript](https://developer.android.com/reference/android/webkit/WebView#evaluateJavascript(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.String%3E))) - ///- 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)) + @override Future evaluateJavascript( {required String source, ContentWorld? contentWorld}) async { Map args = {}; @@ -2150,22 +1933,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return data; } - ///Injects an external JavaScript file into the WebView from a defined url. - /// - ///[scriptHtmlTagAttributes] represents the possible the ` - ///``` - /// - ///Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly: - ///```dart - /// // Inject JavaScript that will receive data back from Flutter - /// inAppWebViewController.evaluateJavascript(source: """ - /// window.flutter_inappwebview.callHandler('test', 'Text from Javascript').then(function(result) { - /// console.log(result); - /// }); - /// """); - ///``` - /// - ///Forbidden names for JavaScript handlers are defined in [_JAVASCRIPT_HANDLER_FORBIDDEN_NAMES]. - /// - ///**NOTE**: This method should be called, for example, in the [WebView.onWebViewCreated] or [WebView.onLoadStart] events or, at least, - ///before you know that your JavaScript code will call the `window.flutter_inappwebview.callHandler` method, - ///otherwise you won't be able to intercept the JavaScript message. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override void addJavaScriptHandler( {required String handlerName, required JavaScriptHandlerCallback callback}) { @@ -2330,41 +1990,18 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController this._javaScriptHandlersMap[handlerName] = (callback); } - ///Removes a JavaScript message handler previously added with the [addJavaScriptHandler] associated to [handlerName] key. - ///Returns the value associated with [handlerName] before it was removed. - ///Returns `null` if [handlerName] was not found. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override JavaScriptHandlerCallback? removeJavaScriptHandler( {required String handlerName}) { return this._javaScriptHandlersMap.remove(handlerName); } - ///Returns `true` if a JavaScript handler with [handlerName] already exists, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override bool hasJavaScriptHandler({required String handlerName}) { return this._javaScriptHandlersMap.containsKey(handlerName); } - ///Takes a screenshot of the WebView's visible viewport and returns a [Uint8List]. Returns `null` if it wasn't be able to take it. - /// - ///[screenshotConfiguration] represents the configuration data to use when generating an image from a web view’s contents. - /// - ///**NOTE for iOS**: available on iOS 11.0+. - /// - ///**NOTE for MacOS**: available on MacOS 10.13+. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future takeScreenshot( {ScreenshotConfiguration? screenshotConfiguration}) async { Map args = {}; @@ -2373,7 +2010,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('takeScreenshot', args); } - ///Use [setSettings] instead. + @override @Deprecated('Use setSettings instead') Future setOptions({required InAppWebViewGroupOptions options}) async { InAppWebViewSettings settings = @@ -2381,7 +2018,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await setSettings(settings: settings); } - ///Use [getSettings] instead. + @override @Deprecated('Use getSettings instead') Future getOptions() async { InAppWebViewSettings? settings = await getSettings(); @@ -2395,13 +2032,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return null; } - ///Sets the WebView settings with the new [settings] and evaluates them. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future setSettings({required InAppWebViewSettings settings}) async { Map args = {}; @@ -2409,13 +2040,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('setSettings', args); } - ///Gets the current WebView settings. Returns `null` if it wasn't able to get them. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future getSettings() async { Map args = {}; @@ -2429,15 +2054,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return null; } - ///Gets the WebHistory for this WebView. This contains the back/forward list for use in querying each item in the history stack. - ///This contains only a snapshot of the current state. - ///Multiple calls to this method may return different objects. - ///The object returned from this method will not be updated to reflect any new state. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future getCopyBackForwardList() async { Map args = {}; Map? result = @@ -2446,18 +2063,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return WebHistory.fromMap(result); } - ///Clears all the WebView's cache. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future clearCache() async { Map args = {}; await channel?.invokeMethod('clearCache', args); } - ///Use [AndroidFindInteractionController.findAll] instead. + @override @Deprecated("Use FindInteractionController.findAll instead") Future findAllAsync({required String find}) async { Map args = {}; @@ -2465,7 +2077,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('findAll', args); } - ///Use [AndroidFindInteractionController.findNext] instead. + @override @Deprecated("Use FindInteractionController.findNext instead") Future findNext({required bool forward}) async { Map args = {}; @@ -2473,42 +2085,26 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('findNext', args); } - ///Use [AndroidFindInteractionController.clearMatches] instead. + @override @Deprecated("Use FindInteractionController.clearMatches instead") Future clearMatches() async { Map args = {}; await channel?.invokeMethod('clearMatches', args); } - ///Use [tRexRunnerHtml] instead. + @override @Deprecated("Use tRexRunnerHtml instead") Future getTRexRunnerHtml() async { return await tRexRunnerHtml; } - ///Use [tRexRunnerCss] instead. + @override @Deprecated("Use tRexRunnerCss instead") Future getTRexRunnerCss() async { return await tRexRunnerCss; } - ///Scrolls the WebView to the position. - /// - ///[x] represents the x position to scroll to. - /// - ///[y] represents the y position to scroll to. - /// - ///[animated] `true` to animate the scroll transition, `false` to make the scoll transition immediate. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: this method is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - View.scrollTo](https://developer.android.com/reference/android/view/View#scrollTo(int,%20int))) - ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) - ///- MacOS - ///- Web ([Official API - Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)) + @override Future scrollTo( {required int x, required int y, bool animated = false}) async { Map args = {}; @@ -2518,23 +2114,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('scrollTo', args); } - ///Moves the scrolled position of the WebView. - /// - ///[x] represents the amount of pixels to scroll by horizontally. - /// - ///[y] represents the amount of pixels to scroll by vertically. - /// - ///[animated] `true` to animate the scroll transition, `false` to make the scoll transition immediate. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: this method is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - View.scrollBy](https://developer.android.com/reference/android/view/View#scrollBy(int,%20int))) - ///- iOS ([Official API - UIScrollView.setContentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset)) - ///- MacOS - ///- Web ([Official API - Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)) + @override Future scrollBy( {required int x, required int y, bool animated = false}) async { Map args = {}; @@ -2544,53 +2124,19 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('scrollBy', args); } - ///On Android native WebView, it pauses all layout, parsing, and JavaScript timers for all WebViews. - ///This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused. - /// - ///**NOTE for iOS**: it is implemented using JavaScript and it is restricted to just this WebView. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript and it is restricted to just this WebView. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.pauseTimers](https://developer.android.com/reference/android/webkit/WebView#pauseTimers())) - ///- iOS - ///- MacOS + @override Future pauseTimers() async { Map args = {}; await channel?.invokeMethod('pauseTimers', args); } - ///On Android, it resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers. - /// - ///**NOTE for iOS**: it is implemented using JavaScript and it is restricted to just this WebView. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript and it is restricted to just this WebView. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.resumeTimers](https://developer.android.com/reference/android/webkit/WebView#resumeTimers())) - ///- iOS - ///- MacOS + @override Future resumeTimers() async { Map args = {}; await channel?.invokeMethod('resumeTimers', args); } - ///Prints the current page. - /// - ///To obtain the [AndroidPrintJobController], use [settings] argument with [PrintJobSettings.handledByClient] to `true`. - ///Otherwise this method will return `null` and the [AndroidPrintJobController] will be handled and disposed automatically by the system. - /// - ///**NOTE for Android**: available on Android 19+. - /// - ///**NOTE for MacOS**: [AndroidPrintJobController] is available on MacOS 11.0+. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. Also, [AndroidPrintJobController] is always `null`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - PrintManager.print](https://developer.android.com/reference/android/print/PrintManager#print(java.lang.String,%20android.print.PrintDocumentAdapter,%20android.print.PrintAttributes))) - ///- 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)) + @override Future printCurrentPage( {PrintJobSettings? settings}) async { Map args = {}; @@ -2604,17 +2150,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return null; } - ///Gets the height of the HTML content. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getContentHeight](https://developer.android.com/reference/android/webkit/WebView#getContentHeight())) - ///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize)) - ///- MacOS - ///- Web ([Official API - Document.documentElement.scrollHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)) + @override Future getContentHeight() async { Map args = {}; var height = await channel?.invokeMethod('getContentHeight', args); @@ -2629,19 +2165,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return height; } - ///Gets the width of the HTML content. - /// - ///**NOTE for Android**: it is implemented using JavaScript. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - UIScrollView.contentSize](https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize)) - ///- MacOS - ///- Web ([Official API - Document.documentElement.scrollWidth](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth)) + @override Future getContentWidth() async { Map args = {}; var height = await channel?.invokeMethod('getContentWidth', args); @@ -2656,18 +2180,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return height; } - ///Performs a zoom operation in this WebView. - /// - ///[zoomFactor] represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 (excluded) to 100.0 (included). - /// - ///[animated] `true` to animate the transition to the new scale, `false` to make the transition immediate. - ///**NOTE**: available only on iOS. - /// - ///**NOTE**: available on Android 21+. - /// - ///**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)) + @override Future zoomBy( {required double zoomFactor, @Deprecated('Use animated instead') bool? iosAnimated, @@ -2681,64 +2194,32 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('zoomBy', args); } - ///Gets the URL that was originally requested for the current page. - ///This is not always the same as the URL passed to [InAppWebView.onLoadStart] because although the load for that URL has begun, - ///the current page may not have changed. Also, there may have been redirects resulting in a different URL to that originally requested. - /// - ///**NOTE for Web**: it will return the current value of the `iframe.src` attribute. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getOriginalUrl](https://developer.android.com/reference/android/webkit/WebView#getOriginalUrl())) - ///- iOS - ///- MacOS - ///- Web + @override Future getOriginalUrl() async { Map args = {}; String? url = await channel?.invokeMethod('getOriginalUrl', args); return url != null ? WebUri(url) : null; } - ///Gets the current zoom scale of the WebView. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS ([Official API - UIScrollView.zoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619419-zoomscale)) + @override Future getZoomScale() async { Map args = {}; return await channel?.invokeMethod('getZoomScale', args); } - ///Use [getZoomScale] instead. + @override @Deprecated('Use getZoomScale instead') Future getScale() async { return await getZoomScale(); } - ///Gets the selected text. - /// - ///**NOTE**: this method is implemented with using JavaScript. - /// - ///**NOTE for Android native WebView**: available only on Android 19+. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future getSelectedText() async { Map args = {}; return await channel?.invokeMethod('getSelectedText', args); } - ///Gets the hit result for hitting an HTML elements. - /// - ///**NOTE**: On iOS, it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getHitTestResult](https://developer.android.com/reference/android/webkit/WebView#getHitTestResult())) - ///- iOS + @override Future getHitTestResult() async { Map args = {}; Map? hitTestResultMap = @@ -2757,21 +2238,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return InAppWebViewHitTestResult(type: type, extra: extra); } - ///Clears the current focus. On iOS and Android native WebView, it will clear also, for example, the current text selection. - /// - ///**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)) + @override Future clearFocus() async { Map args = {}; return await channel?.invokeMethod('clearFocus', args); } - ///Sets or updates the WebView context menu to be used next time it will appear. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS + @override Future setContextMenu(ContextMenu? contextMenu) async { Map args = {}; args.putIfAbsent("contextMenu", () => contextMenu?.toMap()); @@ -2779,13 +2252,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController _inAppBrowser?.setContextMenu(contextMenu); } - ///Requests the anchor or image element URL at the last tapped point. - /// - ///**NOTE**: On iOS, it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.requestFocusNodeHref](https://developer.android.com/reference/android/webkit/WebView#requestFocusNodeHref(android.os.Message))) - ///- iOS + @override Future requestFocusNodeHref() async { Map args = {}; Map? result = @@ -2799,13 +2266,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController : null; } - ///Requests the URL of the image last touched by the user. - /// - ///**NOTE**: On iOS, it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.requestImageRef](https://developer.android.com/reference/android/webkit/WebView#requestImageRef(android.os.Message))) - ///- iOS + @override Future requestImageRef() async { Map args = {}; Map? result = @@ -2817,17 +2278,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController : null; } - ///Returns the list of `` tags of the current WebView. - /// - ///**NOTE**: It is implemented using JavaScript. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web + @override Future> getMetaTags() async { List metaTags = []; @@ -2887,18 +2338,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return metaTags; } - ///Returns an instance of [Color] representing the `content` value of the - ///`` tag of the current WebView, if available, otherwise `null`. - /// - ///**NOTE**: on Android, Web, iOS < 15.0 and MacOS < 12.0, it is implemented using JavaScript. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- 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 + @override Future getMetaThemeColor() async { Color? themeColor; @@ -2935,44 +2375,19 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return themeColor; } - ///Returns the scrolled left position of the current WebView. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - View.getScrollX](https://developer.android.com/reference/android/view/View#getScrollX())) - ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) - ///- MacOS - ///- Web ([Official API - Window.scrollX](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX)) + @override Future getScrollX() async { Map args = {}; return await channel?.invokeMethod('getScrollX', args); } - ///Returns the scrolled top position of the current WebView. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - View.getScrollY](https://developer.android.com/reference/android/view/View#getScrollY())) - ///- iOS ([Official API - UIScrollView.contentOffset](https://developer.apple.com/documentation/uikit/uiscrollview/1619404-contentoffset)) - ///- MacOS - ///- Web ([Official API - Window.scrollY](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY)) + @override Future getScrollY() async { Map args = {}; return await channel?.invokeMethod('getScrollY', args); } - ///Gets the SSL certificate for the main top-level page or null if there is no certificate (the site is not secure). - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.getCertificate](https://developer.android.com/reference/android/webkit/WebView#getCertificate())) - ///- iOS - ///- MacOS + @override Future getCertificate() async { Map args = {}; Map? sslCertificateMap = @@ -2981,16 +2396,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return SslCertificate.fromMap(sslCertificateMap); } - ///Injects the specified [userScript] into the webpage’s content. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future addUserScript({required UserScript userScript}) async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3003,16 +2409,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController } } - ///Injects the [userScripts] into the webpage’s content. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future addUserScripts({required List userScripts}) async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3021,18 +2418,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController } } - ///Removes the specified [userScript] from the webpage’s content. - ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. - ///Returns `true` if [userScript] was in the list, `false` otherwise. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future removeUserScript({required UserScript userScript}) async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3050,17 +2436,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return true; } - ///Removes all the [UserScript]s with [groupName] as group name from the webpage’s content. - ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future removeUserScriptsByGroupName({required String groupName}) async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3085,17 +2461,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('removeUserScriptsByGroupName', args); } - ///Removes the [userScripts] from the webpage’s content. - ///User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future removeUserScripts( {required List userScripts}) async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3105,16 +2471,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController } } - ///Removes all the user scripts from the webpage’s content. - /// - ///**NOTE for iOS and MacOS**: this method will throw an error if the [WebView.windowId] has been set. - ///There isn't any way to add/remove user scripts specific to window WebViews. - ///This is a limitation of the native WebKit APIs. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future removeAllUserScripts() async { assert(webviewParams?.windowId == null || (!Util.isIOS && !Util.isMacOS)); @@ -3125,50 +2482,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('removeAllUserScripts', args); } - ///Returns `true` if the [userScript] has been already added, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override bool hasUserScript({required UserScript userScript}) { return _userScripts[userScript.injectionTime]?.contains(userScript) ?? false; } - ///Executes the specified string as an asynchronous JavaScript function. - /// - ///[functionBody] is the JavaScript string to use as the function body. - ///This method treats the string as an anonymous JavaScript function body and calls it with the named arguments in the arguments parameter. - /// - ///[arguments] is a `Map` of the arguments to pass to the function call. - ///Each key in the `Map` corresponds to the name of an argument in the [functionBody] string, - ///and the value of that key is the value to use during the evaluation of the code. - ///Supported value types can be found in the official Flutter docs: - ///[Platform channel data types support and codecs](https://flutter.dev/docs/development/platform-integration/platform-channels#codec), - ///except for [Uint8List], [Int32List], [Int64List], and [Float64List] that should be converted into a [List]. - ///All items in a `List` or `Map` must also be one of the supported types. - /// - ///[contentWorld], on iOS, it represents the namespace in which to evaluate the JavaScript [source] code. - ///Instead, on Android, it will run the [source] code into an iframe. - ///This parameter doesn’t apply to changes you make to the underlying web content, such as the document’s DOM structure. - ///Those changes remain visible to all scripts, regardless of which content world you specify. - ///For more information about content worlds, see [ContentWorld]. - ///Available on iOS 14.3+. - /// - ///**NOTE**: This method shouldn't be called in the [WebView.onWebViewCreated] or [WebView.onLoadStart] events, - ///because, in these events, the [WebView] is not ready to handle it yet. - ///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events - ///where you know the page is ready "enough". - /// - ///**NOTE for iOS**: available only on iOS 10.3+. - /// - ///**NOTE for Android**: available only on Android 21+. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future callAsyncJavaScript( {required String functionBody, Map arguments = const {}, @@ -3188,24 +2508,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController value: data["value"], error: data["error"]); } - ///Saves the current WebView as a web archive. - ///Returns the file path under which the web archive file was saved, or `null` if saving the file failed. - /// - ///[filePath] represents the file path where the archive should be placed. This value cannot be `null`. - /// - ///[autoname] if `false`, takes [filePath] to be a file. - ///If `true`, [filePath] is assumed to be a directory in which a filename will be chosen according to the URL of the current page. - /// - ///**NOTE for iOS**: Available on iOS 14.0+. If [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.WEBARCHIVE] file extension. - /// - ///**NOTE for MacOS**: Available on MacOS 11.0+. If [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.WEBARCHIVE] file extension. - /// - ///**NOTE for Android**: if [autoname] is `false`, the [filePath] must ends with the [WebArchiveFormat.MHT] file extension. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.saveWebArchive](https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E))) - ///- iOS - ///- MacOS + @override Future saveWebArchive( {required String filePath, bool autoname = false}) async { if (!autoname) { @@ -3223,40 +2526,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('saveWebArchive', args); } - ///Indicates whether the webpage context is capable of using features that require [secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). - ///This is implemented using Javascript (see [window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext)). - /// - ///**NOTE for Android**: available Android 21.0+. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. Returns `false` otherwise. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web ([Official API - Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext)) + @override Future isSecureContext() async { Map args = {}; return await channel?.invokeMethod('isSecureContext', args) ?? false; } - ///Creates a message channel to communicate with JavaScript and returns the message channel with ports that represent the endpoints of this message channel. - ///The HTML5 message channel functionality is described [here](https://html.spec.whatwg.org/multipage/comms.html#messagechannel). - /// - ///The returned message channels are entangled and already in started state. - /// - ///This method should be called when the page is loaded, for example, when the [WebView.onLoadStop] is fired, otherwise the [AndroidWebMessageChannel] won't work. - /// - ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL]. - /// - ///**NOTE for iOS**: it is implemented using JavaScript. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.createWebMessageChannel](https://developer.android.com/reference/androidx/webkit/WebViewCompat#createWebMessageChannel(android.webkit.WebView))) - ///- iOS - ///- MacOS + @override Future createWebMessageChannel() async { Map args = {}; Map? result = @@ -3269,21 +2545,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return webMessageChannel; } - ///Post a message to main frame. The embedded application can restrict the messages to a certain target origin. - ///See [HTML5 spec](https://html.spec.whatwg.org/multipage/comms.html#posting-messages) for how target origin can be used. - /// - ///A target origin can be set as a wildcard ("*"). However this is not recommended. - /// - ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.POST_WEB_MESSAGE]. - /// - ///**NOTE for iOS**: it is implemented using JavaScript. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.postWebMessage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#postWebMessage(android.webkit.WebView,%20androidx.webkit.WebMessageCompat,%20android.net.Uri))) - ///- iOS - ///- MacOS + @override Future postWebMessage( {required WebMessage message, WebUri? targetOrigin}) async { if (targetOrigin == null) { @@ -3295,170 +2557,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('postWebMessage', args); } - ///Adds a [AndroidWebMessageListener] to the WebView and injects a JavaScript object into each frame that the [AndroidWebMessageListener] will listen on. - /// - ///The injected JavaScript object will be named [AndroidWebMessageListener.jsObjectName] in the global scope. - ///This will inject the JavaScript object in any frame whose origin matches [AndroidWebMessageListener.allowedOriginRules] - ///for every navigation after this call, and the JavaScript object will be available immediately when the page begins to load. - /// - ///Each [AndroidWebMessageListener.allowedOriginRules] entry must follow the format `SCHEME "://" [ HOSTNAME_PATTERN [ ":" PORT ] ]`, each part is explained in the below table: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - ///
RuleDescriptionExample
http/https with hostnameSCHEME is http or https; HOSTNAME_PATTERN is a regular hostname; PORT is optional, when not present, the rule will match port 80 for http and port - /// 443 for https. - /// - ///
    - ///
  • https://foobar.com:8080 - Matches https:// URL on port 8080, whose normalized - /// host is foobar.com. - ///
  • - ///
  • https://www.example.com - Matches https:// URL on port 443, whose normalized host - /// is www.example.com. - ///
  • - ///
- ///
http/https with pattern matchingSCHEME is http or https; HOSTNAME_PATTERN is a sub-domain matching - /// pattern with a leading *.; PORT is optional, when not present, the rule will - /// match port 80 for http and port 443 for https. - /// - ///
    - ///
  • https://*.example.com - Matches https://calendar.example.com and - /// https://foo.bar.example.com but not https://example.com. - ///
  • - ///
  • https://*.example.com:8080 - Matches https://calendar.example.com:8080
  • - ///
- ///
http/https with IP literalSCHEME is https or https; HOSTNAME_PATTERN is IP literal; PORT is - /// optional, when not present, the rule will match port 80 for http and port 443 - /// for https. - /// - ///
    - ///
  • https://127.0.0.1 - Matches https:// URL on port 443, whose IPv4 address is - /// 127.0.0.1 - ///
  • - ///
  • https://[::1] or https://[0:0::1]- Matches any URL to the IPv6 loopback - /// address with port 443. - ///
  • - ///
  • https://[::1]:99 - Matches any https:// URL to the IPv6 loopback on port 99.
  • - ///
- ///
Custom schemeSCHEME is a custom scheme; HOSTNAME_PATTERN and PORT must not be - /// present. - /// - ///
    - ///
  • my-app-scheme:// - Matches any my-app-scheme:// URL.
  • - ///
- ///
*Wildcard rule, matches any origin. - ///
    - ///
  • *
  • - ///
- ///
- /// - ///Note that this is a powerful API, as the JavaScript object will be injected when the frame's origin matches any one of the allowed origins. - ///The HTTPS scheme is strongly recommended for security; allowing HTTP origins exposes the injected object to any potential network-based attackers. - ///If a wildcard "*" is provided, it will inject the JavaScript object to all frames. - ///A wildcard should only be used if the app wants **any** third party web page to be able to use the injected object. - ///When using a wildcard, the app must treat received messages as untrustworthy and validate any data carefully. - /// - ///This method can be called multiple times to inject multiple JavaScript objects. - /// - ///Let's say the injected JavaScript object is named `myObject`. We will have following methods on that object once it is available to use: - /// - ///```javascript - /// // Web page (in JavaScript) - /// // message needs to be a JavaScript String, MessagePorts is an optional parameter. - /// myObject.postMessage(message[, MessagePorts]) // on Android - /// myObject.postMessage(message) // on iOS - /// - /// // To receive messages posted from the app side, assign a function to the "onmessage" - /// // property. This function should accept a single "event" argument. "event" has a "data" - /// // property, which is the message string from the app side. - /// myObject.onmessage = function(event) { ... } - /// - /// // To be compatible with DOM EventTarget's addEventListener, it accepts type and listener - /// // parameters, where type can be only "message" type and listener can only be a JavaScript - /// // function for myObject. An event object will be passed to listener with a "data" property, - /// // which is the message string from the app side. - /// myObject.addEventListener(type, listener) - /// - /// // To be compatible with DOM EventTarget's removeEventListener, it accepts type and listener - /// // parameters, where type can be only "message" type and listener can only be a JavaScript - /// // function for myObject. - /// myObject.removeEventListener(type, listener) - ///``` - /// - ///We start the communication between JavaScript and the app from the JavaScript side. - ///In order to send message from the app to JavaScript, it needs to post a message from JavaScript first, - ///so the app will have a [AndroidJavaScriptReplyProxy] object to respond. Example: - /// - ///```javascript - /// // Web page (in JavaScript) - /// myObject.onmessage = function(event) { - /// // prints "Got it!" when we receive the app's response. - /// console.log(event.data); - /// } - /// myObject.postMessage("I'm ready!"); - ///``` - /// - ///```dart - /// // Flutter App - /// child: InAppWebView( - /// onWebViewCreated: (_controllerFromPlatform) async { - /// if (defaultTargetPlatform != TargetPlatform.android || await WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)) { - /// await controller.addWebMessageListener(WebMessageListener( - /// jsObjectName: "myObject", - /// onPostMessage: (message, sourceOrigin, isMainFrame, replyProxy) { - /// // do something about message, sourceOrigin and isMainFrame. - /// replyProxy.postMessage("Got it!"); - /// }, - /// )); - /// } - /// await controller.loadUrl(urlRequest: URLRequest(url: WebUri("https://www.example.com"))); - /// }, - /// ), - ///``` - /// - ///**NOTE for Android**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.WEB_MESSAGE_LISTENER]. - /// - ///**NOTE for iOS**: it is implemented using JavaScript. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.WebMessageListener](https://developer.android.com/reference/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,%20java.lang.String,%20java.util.Set%3Cjava.lang.String%3E,%20androidx.webkit.WebViewCompat.WebMessageListener))) - ///- iOS - ///- MacOS @override Future addWebMessageListener( PlatformWebMessageListener webMessageListener) async { @@ -3476,12 +2574,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('addWebMessageListener', args); } - ///Returns `true` if the [webMessageListener] has been already added, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS @override bool hasWebMessageListener(PlatformWebMessageListener webMessageListener) { return _webMessageListeners.contains(webMessageListener) || @@ -3489,17 +2581,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController .contains(webMessageListener.params.jsObjectName); } - ///Returns `true` if the webpage can scroll vertically, otherwise `false`. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web @override Future canScrollVertically() async { Map args = {}; @@ -3507,17 +2588,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///Returns `true` if the webpage can scroll horizontally, otherwise `false`. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**NOTE for MacOS**: it is implemented using JavaScript. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS - ///- Web @override Future canScrollHorizontally() async { Map args = {}; @@ -3525,18 +2595,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///Starts Safe Browsing initialization. - /// - ///URL loads are not guaranteed to be protected by Safe Browsing until after the this method returns true. - ///Safe Browsing is not fully supported on all devices. For those devices this method will returns false. - /// - ///This should not be called if Safe Browsing has been disabled by manifest tag or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. - ///This prepares resources used for Safe Browsing. - /// - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.START_SAFE_BROWSING]. - /// - ///**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))) @override Future startSafeBrowsing() async { Map args = {}; @@ -3544,44 +2602,24 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.clearSslPreferences](https://developer.android.com/reference/android/webkit/WebView#clearSslPreferences())) @override Future clearSslPreferences() async { Map args = {}; await channel?.invokeMethod('clearSslPreferences', args); } - ///Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation. Note that this call does not pause JavaScript. - ///To pause JavaScript globally, use [InAppWebViewController.pauseTimers]. To resume WebView, call [resume]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.onPause](https://developer.android.com/reference/android/webkit/WebView#onPause())) @override Future pause() async { Map args = {}; await channel?.invokeMethod('pause', args); } - ///Resumes a WebView after a previous call to [pause]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.onResume](https://developer.android.com/reference/android/webkit/WebView#onResume())) @override Future resume() async { Map args = {}; await channel?.invokeMethod('resume', args); } - ///Scrolls the contents of this WebView down by half the page size. - ///Returns `true` if the page was scrolled. - /// - ///[bottom] `true` to jump to bottom of page. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.pageDown](https://developer.android.com/reference/android/webkit/WebView#pageDown(boolean))) @override Future pageDown({required bool bottom}) async { Map args = {}; @@ -3589,13 +2627,6 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('pageDown', args) ?? false; } - ///Scrolls the contents of this WebView up by half the view size. - ///Returns `true` if the page was scrolled. - /// - ///[top] `true` to jump to the top of the page. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.pageUp](https://developer.android.com/reference/android/webkit/WebView#pageUp(boolean))) @override Future pageUp({required bool top}) async { Map args = {}; @@ -3603,58 +2634,31 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('pageUp', args) ?? false; } - ///Performs zoom in in this WebView. - ///Returns `true` if zoom in succeeds, `false` if no zoom changes. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.zoomIn](https://developer.android.com/reference/android/webkit/WebView#zoomIn())) @override Future zoomIn() async { Map args = {}; return await channel?.invokeMethod('zoomIn', args) ?? false; } - ///Performs zoom out in this WebView. - ///Returns `true` if zoom out succeeds, `false` if no zoom changes. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.zoomOut](https://developer.android.com/reference/android/webkit/WebView#zoomOut())) + @override Future zoomOut() async { Map args = {}; return await channel?.invokeMethod('zoomOut', args) ?? false; } - ///Clears the internal back/forward list. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.clearHistory](https://developer.android.com/reference/android/webkit/WebView#clearHistory())) + @override Future clearHistory() async { Map args = {}; return await channel?.invokeMethod('clearHistory', args); } - ///Reloads the current page, performing end-to-end revalidation using cache-validating conditionals if possible. - /// - ///**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)) + @override Future reloadFromOrigin() async { Map args = {}; await channel?.invokeMethod('reloadFromOrigin', args); } - ///Generates PDF data from the web view’s contents asynchronously. - ///Returns `null` if a problem occurred. - /// - ///[pdfConfiguration] represents the object that specifies the portion of the web view to capture as PDF data. - /// - ///**NOTE for iOS**: available only on iOS 14.0+. - /// - ///**NOTE for MacOS**: available only on MacOS 11.0+. - /// - ///**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)) + @override Future createPdf( {@Deprecated("Use pdfConfiguration instead") // ignore: deprecated_member_use_from_same_package @@ -3666,160 +2670,73 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return await channel?.invokeMethod('createPdf', args); } - ///Creates a web archive of the web view’s current contents asynchronously. - ///Returns `null` if a problem occurred. - /// - ///**NOTE for iOS**: available only on iOS 14.0+. - /// - ///**NOTE for MacOS**: available only on MacOS 11.0+. - /// - ///**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)) + @override Future createWebArchiveData() async { Map args = {}; return await channel?.invokeMethod('createWebArchiveData', args); } - ///A Boolean value indicating whether all resources on the page have been loaded over securely encrypted connections. - /// - ///**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)) + @override Future hasOnlySecureContent() async { Map args = {}; return await channel?.invokeMethod('hasOnlySecureContent', args) ?? false; } - ///Pauses playback of all media in the web view. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future pauseAllMediaPlayback() async { Map args = {}; return await channel?.invokeMethod('pauseAllMediaPlayback', args); } - ///Changes whether the webpage is suspending playback of all media in the page. - ///Pass `true` to pause all media the web view is playing. Neither the user nor the webpage can resume playback until you call this method again with `false`. - /// - ///[suspended] represents a [bool] value that indicates whether the webpage should suspend media playback. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future setAllMediaPlaybackSuspended({required bool suspended}) async { Map args = {}; args.putIfAbsent("suspended", () => suspended); return await channel?.invokeMethod('setAllMediaPlaybackSuspended', args); } - ///Closes all media the web view is presenting, including picture-in-picture video and fullscreen video. - /// - ///**NOTE for iOS**: available on iOS 14.5+. - /// - ///**NOTE for MacOS**: available on MacOS 11.3+. - /// - ///**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)). + @override Future closeAllMediaPresentations() async { Map args = {}; return await channel?.invokeMethod('closeAllMediaPresentations', args); } - ///Requests the playback status of media in the web view. - ///Returns a [MediaPlaybackState] that indicates whether the media in the web view is playing, paused, or suspended. - ///If there’s no media in the web view to play, this method provides [MediaPlaybackState.NONE]. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future requestMediaPlaybackState() async { Map args = {}; return MediaPlaybackState.fromNativeValue( await channel?.invokeMethod('requestMediaPlaybackState', args)); } - ///Returns `true` if the [WebView] is in fullscreen mode, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future isInFullscreen() async { Map args = {}; return await channel?.invokeMethod('isInFullscreen', args) ?? false; } - ///Returns a [MediaCaptureState] that indicates whether the webpage is using the camera to capture images or video. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future getCameraCaptureState() async { Map args = {}; return MediaCaptureState.fromNativeValue( await channel?.invokeMethod('getCameraCaptureState', args)); } - ///Changes whether the webpage is using the camera to capture images or video. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future setCameraCaptureState({required MediaCaptureState state}) async { Map args = {}; args.putIfAbsent('state', () => state.toNativeValue()); await channel?.invokeMethod('setCameraCaptureState', args); } - ///Returns a [MediaCaptureState] that indicates whether the webpage is using the microphone to capture audio. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future getMicrophoneCaptureState() async { Map args = {}; return MediaCaptureState.fromNativeValue( await channel?.invokeMethod('getMicrophoneCaptureState', args)); } - ///Changes whether the webpage is using the microphone to capture audio. - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future setMicrophoneCaptureState( {required MediaCaptureState state}) async { Map args = {}; @@ -3827,31 +2744,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('setMicrophoneCaptureState', args); } - ///Loads the web content from the data you provide as if the data were the response to the request. - ///If [urlResponse] is `null`, it loads the web content from the data as an utf8 encoded HTML string as the response to the request. - /// - ///[urlRequest] represents a URL request that specifies the base URL and other loading details the system uses to interpret the data you provide. - /// - ///[urlResponse] represents a response the system uses to interpret the data you provide. - /// - ///[data] represents the data or the utf8 encoded HTML string to use as the contents of the webpage. - /// - ///Example: - ///```dart - ///controller.loadSimulateloadSimulatedRequestdRequest(urlRequest: URLRequest( - /// url: WebUri("https://flutter.dev"), - /// ), - /// data: Uint8List.fromList(utf8.encode("

Hello

")) - ///); - ///``` - /// - ///**NOTE for iOS**: available on iOS 15.0+. - /// - ///**NOTE for MacOS**: available on MacOS 12.0+. - /// - ///**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)). + @override Future loadSimulatedRequest( {required URLRequest urlRequest, required Uint8List data, @@ -3863,21 +2756,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController await channel?.invokeMethod('loadSimulatedRequest', args); } - ///Returns the iframe `id` attribute used on the Web platform. - /// - ///**Supported Platforms/Implementations**: - ///- Web + @override Future getIFrameId() async { Map args = {}; return await channel?.invokeMethod('getIFrameId', args); } - ///Gets the default user agent. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebSettings.getDefaultUserAgent](https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context))) - ///- iOS - ///- MacOS + @override Future getDefaultUserAgent() async { Map args = {}; return await _staticChannel.invokeMethod( @@ -3885,27 +2770,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController ''; } - ///Clears the client certificate preferences stored in response to proceeding/cancelling client cert requests. - ///Note that WebView automatically clears these preferences when the system keychain is updated. - ///The preferences are shared by all the WebViews that are created by the embedder application. - /// - ///**NOTE**: On iOS certificate-based credentials are never stored permanently. - /// - ///**NOTE**: available on Android 21+. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.clearClientCertPreferences](https://developer.android.com/reference/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable))) + @override Future clearClientCertPreferences() async { Map args = {}; await _staticChannel.invokeMethod('clearClientCertPreferences', args); } - ///Returns a URL pointing to the privacy policy for Safe Browsing reporting. - /// - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.getSafeBrowsingPrivacyPolicyUrl](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl())) + @override Future getSafeBrowsingPrivacyPolicyUrl() async { Map args = {}; String? url = await _staticChannel.invokeMethod( @@ -3913,30 +2784,13 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return url != null ? WebUri(url) : null; } - ///Use [setSafeBrowsingAllowlist] instead. + @override @Deprecated("Use setSafeBrowsingAllowlist instead") Future setSafeBrowsingWhitelist({required List hosts}) async { return await setSafeBrowsingAllowlist(hosts: hosts); } - ///Sets the list of hosts (domain names/IP addresses) that are exempt from SafeBrowsing checks. The list is global for all the WebViews. - /// - /// Each rule should take one of these: - ///| Rule | Example | Matches Subdomain | - ///| -- | -- | -- | - ///| HOSTNAME | example.com | Yes | - ///| .HOSTNAME | .example.com | No | - ///| IPV4_LITERAL | 192.168.1.1 | No | - ///| IPV6_LITERAL_WITH_BRACKETS | [10:20:30:40:50:60:70:80] | No | - /// - ///All other rules, including wildcards, are invalid. The correct syntax for hosts is defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3.2.2). - /// - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SAFE_BROWSING_ALLOWLIST]. - /// - ///[hosts] represents the list of hosts. This value must never be `null`. - /// - ///**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))) + @override Future setSafeBrowsingAllowlist({required List hosts}) async { Map args = {}; args.putIfAbsent('hosts', () => hosts); @@ -3945,18 +2799,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///If WebView has already been loaded into the current process this method will return the package that was used to load it. - ///Otherwise, the package that would be used if the WebView was loaded right now will be returned; - ///this does not cause WebView to be loaded, so this information may become outdated at any time. - ///The WebView package changes either when the current WebView package is updated, disabled, or uninstalled. - ///It can also be changed through a Developer Setting. If the WebView package changes, any app process that - ///has loaded WebView will be killed. - ///The next time the app starts and loads WebView it will use the new WebView package instead. - /// - ///**NOTE**: available only on Android 21+. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.getCurrentWebViewPackage](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context))) + @override Future getCurrentWebViewPackage() async { Map args = {}; Map? packageInfo = @@ -3965,16 +2808,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController return WebViewPackageInfo.fromMap(packageInfo); } - ///Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. - ///This flag can be enabled in order to facilitate debugging of web layouts and JavaScript code running inside WebViews. - ///Please refer to WebView documentation for the debugging guide. The default is `false`. - /// - ///[debuggingEnabled] whether to enable web contents debugging. - /// - ///**NOTE**: available only on Android 19+. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.setWebContentsDebuggingEnabled](https://developer.android.com/reference/android/webkit/WebView#setWebContentsDebuggingEnabled(boolean))) + @override Future setWebContentsDebuggingEnabled(bool debuggingEnabled) async { Map args = {}; args.putIfAbsent('debuggingEnabled', () => debuggingEnabled); @@ -3982,37 +2816,14 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController 'setWebContentsDebuggingEnabled', args); } - ///Gets the WebView variations encoded to be used as the X-Client-Data HTTP header. - /// - ///The app is responsible for adding the X-Client-Data header to any request - ///that may use variations metadata, such as requests to Google web properties. - ///The returned string will be a base64 encoded ClientVariations proto: - ///https://source.chromium.org/chromium/chromium/src/+/main:components/variations/proto/client_variations.proto - /// - ///The string may be empty if the header is not available. - /// - ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.GET_VARIATIONS_HEADER]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.getVariationsHeader](https://developer.android.com/reference/androidx/webkit/WebViewCompat#getVariationsHeader())) + @override Future getVariationsHeader() async { Map args = {}; return await _staticChannel.invokeMethod( 'getVariationsHeader', args); } - ///Returns `true` if WebView is running in multi process mode. - /// - ///In Android O and above, WebView may run in "multiprocess" mode. - ///In multiprocess mode, rendering of web content is performed by a sandboxed - ///renderer process separate to the application process. - ///This renderer process may be shared with other WebViews in the application, - ///but is not shared with other application processes. - /// - ///**NOTE for Android native WebView**: This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.MULTI_PROCESS]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebViewCompat.isMultiProcessEnabled](https://developer.android.com/reference/androidx/webkit/WebViewCompat#isMultiProcessEnabled())) + @override Future isMultiProcessEnabled() async { Map args = {}; return await _staticChannel.invokeMethod( @@ -4020,47 +2831,20 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController false; } - ///Indicate that the current process does not intend to use WebView, - ///and that an exception should be thrown if a WebView is created or any other - ///methods in the `android.webkit` package are used. - /// - ///Applications with multiple processes may wish to call this in processes that - ///are not intended to use WebView to avoid accidentally incurring the memory usage - ///of initializing WebView in long-lived processes that have no need for it, - ///and to prevent potential data directory conflicts (see [ProcessGlobalConfigSettings.dataDirectorySuffix]). - /// - ///**NOTE for Android**: available only on Android 28+. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebView.disableWebView](https://developer.android.com/reference/android/webkit/WebView.html#disableWebView())) + @override Future disableWebView() async { Map args = {}; await _staticChannel.invokeMethod('disableWebView', args); } - ///Returns a Boolean value that indicates whether WebKit natively supports resources with the specified URL scheme. - /// - ///[urlScheme] represents the URL scheme associated with the resource. - /// - ///**NOTE for iOS**: available only on iOS 11.0+. - /// - ///**NOTE for MacOS**: available only on MacOS 10.13+. - /// - ///**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)) + @override Future handlesURLScheme(String urlScheme) async { Map args = {}; args.putIfAbsent('urlScheme', () => urlScheme); return await _staticChannel.invokeMethod('handlesURLScheme', args); } - ///Disposes the WebView that is using the [keepAlive] instance - ///for the keep alive feature. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS + @override Future disposeKeepAlive(InAppWebViewKeepAlive keepAlive) async { Map args = {}; args.putIfAbsent('keepAliveId', () => keepAlive.id); @@ -4068,30 +2852,19 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController _keepAliveMap[keepAlive] = null; } - ///Gets the html (with javascript) of the Chromium's t-rex runner game. Used in combination with [tRexRunnerCss]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future get tRexRunnerHtml async => await rootBundle.loadString( 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html'); - ///Gets the css of the Chromium's t-rex runner game. Used in combination with [tRexRunnerHtml]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS + @override Future get tRexRunnerCss async => await rootBundle.loadString( 'packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css'); - ///View ID used internally. + @override dynamic getViewId() { return id; } - ///Disposes the controller. @override void dispose({bool isKeepAlive = false}) { disposeChannel(removeMethodCallHandler: !isKeepAlive); diff --git a/flutter_inappwebview_android/lib/src/print_job/print_job_controller.dart b/flutter_inappwebview_android/lib/src/print_job/print_job_controller.dart index 64a904df..692c847c 100644 --- a/flutter_inappwebview_android/lib/src/print_job/print_job_controller.dart +++ b/flutter_inappwebview_android/lib/src/print_job/print_job_controller.dart @@ -24,12 +24,7 @@ class AndroidPrintJobControllerCreationParams } } -///Class representing a print job eventually returned by [InAppWebViewController.printCurrentPage]. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformPrintJobController} class AndroidPrintJobController extends PlatformPrintJobController with ChannelController { /// Constructs a [AndroidPrintJobController]. @@ -60,51 +55,26 @@ class AndroidPrintJobController extends PlatformPrintJobController } } - ///Cancels this print job. - ///You can request cancellation of a queued, started, blocked, or failed print job. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - PrintJob.cancel](https://developer.android.com/reference/android/print/PrintJob#cancel())) + @override Future cancel() async { Map args = {}; await channel?.invokeMethod('cancel', args); } - ///Restarts this print job. - ///You can request restart of a failed print job. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - PrintJob.restart](https://developer.android.com/reference/android/print/PrintJob#restart())) + @override Future restart() async { Map args = {}; await channel?.invokeMethod('restart', args); } - ///Dismisses the printing-options sheet or popover. - /// - ///You should dismiss the printing options when they are presented in a sheet or - ///animated from a rectangle and the user changes the orientation of the device. - ///(This, of course, assumes your application responds to orientation changes.) - ///You should then present the printing options again once the new orientation takes effect. - /// - ///**Supported Platforms/Implementations**: - ///- iOS + @override Future dismiss({bool animated: true}) async { Map args = {}; args.putIfAbsent("animated", () => animated); await channel?.invokeMethod('dismiss', args); } - ///Gets the [PrintJobInfo] that describes this job. - /// - ///**NOTE**: The returned info object is a snapshot of the - ///current print job state. Every call to this method returns a fresh - ///info object that reflects the current print job state. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - PrintJob.getInfo](https://developer.android.com/reference/android/print/PrintJob#getInfo())) - ///- iOS - ///- MacOS + @override Future getInfo() async { Map args = {}; Map? infoMap = @@ -112,12 +82,6 @@ class AndroidPrintJobController extends PlatformPrintJobController return PrintJobInfo.fromMap(infoMap); } - ///Disposes the print job. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- MacOS @override Future dispose() async { Map args = {}; diff --git a/flutter_inappwebview_android/lib/src/process_global_config.dart b/flutter_inappwebview_android/lib/src/process_global_config.dart index a8f843b3..1f4d6fe0 100644 --- a/flutter_inappwebview_android/lib/src/process_global_config.dart +++ b/flutter_inappwebview_android/lib/src/process_global_config.dart @@ -25,28 +25,7 @@ class AndroidProcessGlobalConfigCreationParams } } -///Process Global Configuration for [WebView]. -///WebView has some process-global configuration parameters -///that cannot be changed once WebView has been loaded. -///This class allows apps to set these parameters. -/// -///If it is used, the configuration should be set and apply should -///be called prior to loading WebView into the calling process. -///Most of the methods in `android.webkit` and `androidx.webkit` packages load WebView, -///so the configuration should be applied before calling any of these methods. -/// -///The following code configures the data directory suffix that WebView uses and -///then applies the configuration. WebView uses this configuration when it is loaded. -/// -///[apply] can only be called once. -/// -///Only a single thread should access this class at a given time. -/// -///The configuration should be set up as early as possible during application startup, -///to ensure that it happens before any other thread can call a method that loads [WebView]. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView ([Official API - ProcessGlobalConfig](https://developer.android.com/reference/androidx/webkit/ProcessGlobalConfig)) +///{@macro flutter_inappwebview_platform_interface.PlatformProcessGlobalConfig} class AndroidProcessGlobalConfig extends PlatformProcessGlobalConfig with ChannelController { /// Creates a new [AndroidProcessGlobalConfig]. @@ -79,13 +58,7 @@ class AndroidProcessGlobalConfig extends PlatformProcessGlobalConfig Future _handleMethod(MethodCall call) async {} - ///Applies the configuration to be used by [WebView] on loading. - ///This method can only be called once. - /// - ///Calling this method will not cause [WebView] to be loaded and will not block the calling thread. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - ProcessGlobalConfig.apply](https://developer.android.com/reference/androidx/webkit/ProcessGlobalConfig#apply(androidx.webkit.ProcessGlobalConfig))) + @override Future apply({required ProcessGlobalConfigSettings settings}) async { Map args = {}; args.putIfAbsent("settings", () => settings.toMap()); diff --git a/flutter_inappwebview_android/lib/src/proxy_controller.dart b/flutter_inappwebview_android/lib/src/proxy_controller.dart index ad0d3518..07649ac8 100644 --- a/flutter_inappwebview_android/lib/src/proxy_controller.dart +++ b/flutter_inappwebview_android/lib/src/proxy_controller.dart @@ -25,16 +25,7 @@ class AndroidProxyControllerCreationParams } } -///Manages setting and clearing a process-specific override for the Android system-wide proxy settings that govern network requests made by [WebView]. -/// -///[WebView] may make network requests in order to fetch content that is not otherwise read from the file system or provided directly by application code. -///In this case by default the system-wide Android network proxy settings are used to redirect requests to appropriate proxy servers. -/// -///In the rare case that it is necessary for an application to explicitly specify its proxy configuration, -///this API may be used to explicitly specify the proxy rules that govern WebView initiated network requests. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView ([Official API - ProxyController](https://developer.android.com/reference/androidx/webkit/ProxyController)) +///{@macro flutter_inappwebview_platform_interface.PlatformProxyController} class AndroidProxyController extends PlatformProxyController with ChannelController { /// Creates a new [AndroidProxyController]. @@ -66,24 +57,14 @@ class AndroidProxyController extends PlatformProxyController Future _handleMethod(MethodCall call) async {} - ///Sets [ProxySettings] which will be used by all [WebView]s in the app. - ///URLs that match patterns in the bypass list will not be directed to any proxy. - ///Instead, the request will be made directly to the origin specified by the URL. - ///Network connections are not guaranteed to immediately use the new proxy setting; wait for the method to return before loading a page. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - ProxyController.setProxyOverride](https://developer.android.com/reference/androidx/webkit/ProxyController#setProxyOverride(androidx.webkit.ProxyConfig,%20java.util.concurrent.Executor,%20java.lang.Runnable))) + @override Future setProxyOverride({required ProxySettings settings}) async { Map args = {}; args.putIfAbsent("settings", () => settings.toMap()); await channel?.invokeMethod('setProxyOverride', args); } - ///Clears the proxy settings. - ///Network connections are not guaranteed to immediately use the new proxy setting; wait for the method to return before loading a page. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - ProxyController.clearProxyOverride](https://developer.android.com/reference/androidx/webkit/ProxyController#clearProxyOverride(java.util.concurrent.Executor,%20java.lang.Runnable))) + @override Future clearProxyOverride() async { Map args = {}; await channel?.invokeMethod('clearProxyOverride', args); diff --git a/flutter_inappwebview_android/lib/src/pull_to_refresh/pull_to_refresh_controller.dart b/flutter_inappwebview_android/lib/src/pull_to_refresh/pull_to_refresh_controller.dart index c5062591..aa651ce9 100644 --- a/flutter_inappwebview_android/lib/src/pull_to_refresh/pull_to_refresh_controller.dart +++ b/flutter_inappwebview_android/lib/src/pull_to_refresh/pull_to_refresh_controller.dart @@ -26,17 +26,7 @@ class AndroidPullToRefreshControllerCreationParams } } -///A standard controller that can initiate the refreshing of a scroll view’s contents. -///This should be used whenever the user can refresh the contents of a WebView via a vertical swipe gesture. -/// -///All the methods should be called only when the WebView has been created or is already running -///(for example [WebView.onWebViewCreated] or [InAppBrowser.onBrowserCreated]). -/// -///**NOTE for Android**: to be able to use the "pull-to-refresh" feature, [InAppWebViewSettings.useHybridComposition] must be `true`. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS +///{@macro flutter_inappwebview_platform_interface.PlatformPullToRefreshController} class AndroidPullToRefreshController extends PlatformPullToRefreshController with ChannelController { /// Constructs a [AndroidPullToRefreshController]. @@ -71,11 +61,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController return null; } - ///Sets whether the pull-to-refresh feature is enabled or not. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setEnabled](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setEnabled(boolean))) - ///- iOS ([Official API - UIScrollView.refreshControl](https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol)) @override Future setEnabled(bool enabled) async { Map args = {}; @@ -83,11 +68,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setEnabled', args); } - ///Returns `true` is pull-to-refresh feature is enabled, otherwise `false`. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - View.isEnabled](https://developer.android.com/reference/android/view/View#isEnabled())) - ///- iOS ([Official API - UIScrollView.refreshControl](https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol)) @override Future isEnabled() async { Map args = {}; @@ -100,51 +80,22 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setRefreshing', args); } - ///Tells the controller that a refresh operation was started programmatically. - /// - ///Call this method when an external event source triggers a programmatic refresh of your scrolling view. - ///This method updates the state of the refresh control to reflect the in-progress refresh operation. - ///When the refresh operation ends, be sure to call the [endRefreshing] method to return the controller to its default state. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS @override Future beginRefreshing() async { return await _setRefreshing(true); } - ///Tells the controller that a refresh operation has ended. - /// - ///Call this method at the end of any refresh operation (whether it was initiated programmatically or by the user) - ///to return the refresh control to its default state. - ///If the refresh control is at least partially visible, calling this method also hides it. - ///If animations are also enabled, the control is hidden using an animation. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS @override Future endRefreshing() async { await _setRefreshing(false); } - ///Returns whether a refresh operation has been triggered and is in progress. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.isRefreshing](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#isRefreshing())) - ///- iOS ([Official API - UIRefreshControl.isRefreshing](https://developer.apple.com/documentation/uikit/uirefreshcontrol/1624844-isrefreshing)) @override Future isRefreshing() async { Map args = {}; return await channel?.invokeMethod('isRefreshing', args) ?? false; } - ///Sets the color of the refresh control. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setColorSchemeColors](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setColorSchemeColors(int...))) - ///- iOS ([Official API - UIRefreshControl.tintColor](https://developer.apple.com/documentation/uikit/uirefreshcontrol/1624847-tintcolor)) @override Future setColor(Color color) async { Map args = {}; @@ -152,11 +103,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setColor', args); } - ///Sets the background color of the refresh control. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setProgressBackgroundColorSchemeColor](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setProgressBackgroundColorSchemeColor(int))) - ///- iOS ([Official API - UIView.backgroundColor](https://developer.apple.com/documentation/uikit/uiview/1622591-backgroundcolor)) @override Future setBackgroundColor(Color color) async { Map args = {}; @@ -164,10 +110,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setBackgroundColor', args); } - ///Set the distance to trigger a sync in dips. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setDistanceToTriggerSync](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setDistanceToTriggerSync(int))) @override Future setDistanceToTriggerSync(int distanceToTriggerSync) async { Map args = {}; @@ -175,10 +117,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setDistanceToTriggerSync', args); } - ///Sets the distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setSlingshotDistance](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setSlingshotDistance(int))) @override Future setSlingshotDistance(int slingshotDistance) async { Map args = {}; @@ -186,10 +124,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setSlingshotDistance', args); } - ///Gets the default distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.DEFAULT_SLINGSHOT_DISTANCE](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#DEFAULT_SLINGSHOT_DISTANCE())) @override Future getDefaultSlingshotDistance() async { Map args = {}; @@ -198,7 +132,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController 0; } - ///Use [setIndicatorSize] instead. @Deprecated("Use setIndicatorSize instead") @override Future setSize(AndroidPullToRefreshSize size) async { @@ -207,10 +140,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setSize', args); } - ///Sets the size of the refresh indicator. One of [PullToRefreshSize.DEFAULT], or [PullToRefreshSize.LARGE]. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - SwipeRefreshLayout.setSize](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setSize(int))) @override Future setIndicatorSize(PullToRefreshSize size) async { Map args = {}; @@ -218,7 +147,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setSize', args); } - ///Use [setStyledTitle] instead. @Deprecated("Use setStyledTitle instead") @override Future setAttributedTitle(IOSNSAttributedString attributedTitle) async { @@ -227,10 +155,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setStyledTitle', args); } - ///Sets the styled title text to display in the refresh control. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - UIRefreshControl.attributedTitle](https://developer.apple.com/documentation/uikit/uirefreshcontrol/1624845-attributedtitle)) @override Future setStyledTitle(AttributedString attributedTitle) async { Map args = {}; @@ -238,7 +162,6 @@ class AndroidPullToRefreshController extends PlatformPullToRefreshController await channel?.invokeMethod('setStyledTitle', args); } - ///Disposes the controller. @override void dispose({bool isKeepAlive = false}) { disposeChannel(removeMethodCallHandler: !isKeepAlive); diff --git a/flutter_inappwebview_android/lib/src/service_worker_controller.dart b/flutter_inappwebview_android/lib/src/service_worker_controller.dart index 7c51306a..8a5a7919 100644 --- a/flutter_inappwebview_android/lib/src/service_worker_controller.dart +++ b/flutter_inappwebview_android/lib/src/service_worker_controller.dart @@ -25,12 +25,7 @@ class AndroidServiceWorkerControllerCreationParams } } -///Class that manages Service Workers used by [WebView]. -/// -///**NOTE**: available on Android 24+. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView ([Official API - ServiceWorkerControllerCompat](https://developer.android.com/reference/androidx/webkit/ServiceWorkerControllerCompat)) +///{@macro flutter_inappwebview_platform_interface.PlatformServiceWorkerController} class AndroidServiceWorkerController extends PlatformServiceWorkerController with ChannelController { /// Creates a new [AndroidServiceWorkerController]. @@ -68,13 +63,10 @@ class AndroidServiceWorkerController extends PlatformServiceWorkerController ServiceWorkerClient? _serviceWorkerClient; + @override ServiceWorkerClient? get serviceWorkerClient => _serviceWorkerClient; - ///Sets the client to capture service worker related callbacks. - ///A [ServiceWorkerClient] should be set before any service workers are active, e.g. a safe place is before any WebView instances are created or pages loaded. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - ServiceWorkerControllerCompat.setServiceWorkerClient](https://developer.android.com/reference/androidx/webkit/ServiceWorkerControllerCompat#setServiceWorkerClient(androidx.webkit.ServiceWorkerClientCompat))) + @override Future setServiceWorkerClient(ServiceWorkerClient? value) async { Map args = {}; args.putIfAbsent('isNull', () => value == null); @@ -106,96 +98,56 @@ class AndroidServiceWorkerController extends PlatformServiceWorkerController return null; } - ///Gets whether Service Workers support content URL access. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getAllowContentAccess() + @override Future getAllowContentAccess() async { Map args = {}; return await channel?.invokeMethod('getAllowContentAccess', args) ?? false; } - ///Gets whether Service Workers support file access. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_FILE_ACCESS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getAllowFileAccess() + @override Future getAllowFileAccess() async { Map args = {}; return await channel?.invokeMethod('getAllowFileAccess', args) ?? false; } - ///Gets whether Service Workers are prohibited from loading any resources from the network. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getBlockNetworkLoads() + @override Future getBlockNetworkLoads() async { Map args = {}; return await channel?.invokeMethod('getBlockNetworkLoads', args) ?? false; } - ///Gets the current setting for overriding the cache mode. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_CACHE_MODE]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getCacheMode() + @override Future getCacheMode() async { Map args = {}; return CacheMode.fromNativeValue( await channel?.invokeMethod('getCacheMode', args)); } - ///Enables or disables content URL access from Service Workers. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#setAllowContentAccess(boolean) + @override Future setAllowContentAccess(bool allow) async { Map args = {}; args.putIfAbsent("allow", () => allow); await channel?.invokeMethod('setAllowContentAccess', args); } - ///Enables or disables file access within Service Workers. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_FILE_ACCESS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#setAllowFileAccess(boolean) + @override Future setAllowFileAccess(bool allow) async { Map args = {}; args.putIfAbsent("allow", () => allow); await channel?.invokeMethod('setAllowFileAccess', args); } - ///Sets whether Service Workers should not load resources from the network. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#setBlockNetworkLoads(boolean) + @override Future setBlockNetworkLoads(bool flag) async { Map args = {}; args.putIfAbsent("flag", () => flag); await channel?.invokeMethod('setBlockNetworkLoads', args); } - ///Overrides the way the cache is used. - ///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_CACHE_MODE]. - /// - ///**NOTE**: available on Android 24+. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#setCacheMode(int) + @override Future setCacheMode(CacheMode mode) async { Map args = {}; args.putIfAbsent("mode", () => mode.toNativeValue()); diff --git a/flutter_inappwebview_android/lib/src/tracing_controller.dart b/flutter_inappwebview_android/lib/src/tracing_controller.dart index 4eedc1d4..9d619f07 100644 --- a/flutter_inappwebview_android/lib/src/tracing_controller.dart +++ b/flutter_inappwebview_android/lib/src/tracing_controller.dart @@ -25,15 +25,7 @@ class AndroidTracingControllerCreationParams } } -///Manages tracing of [WebView]s. -///In particular provides functionality for the app to enable/disable tracing of parts of code and to collect tracing data. -///This is useful for profiling performance issues, debugging and memory usage analysis in production and real life scenarios. -/// -///The resulting trace data is sent back as a byte sequence in json format. -///This file can be loaded in "chrome://tracing" for further analysis. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView ([Official API - TracingController](https://developer.android.com/reference/androidx/webkit/TracingController)) +///{@macro flutter_inappwebview_platform_interface.PlatformTracingController} class AndroidTracingController extends PlatformTracingController with ChannelController { /// Creates a new [AndroidTracingController]. @@ -65,39 +57,21 @@ class AndroidTracingController extends PlatformTracingController Future _handleMethod(MethodCall call) async {} - ///Starts tracing all [WebView]s. - ///Depending on the trace mode in trace config specifies how the trace events are recorded. - ///For tracing modes [TracingMode.RECORD_UNTIL_FULL] and [TracingMode.RECORD_CONTINUOUSLY] - ///the events are recorded using an internal buffer and flushed to the outputStream - ///when [stop] is called. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - TracingController.start](https://developer.android.com/reference/android/webkit/TracingController#start(android.webkit.TracingConfig))) + @override Future start({required TracingSettings settings}) async { Map args = {}; args.putIfAbsent("settings", () => settings.toMap()); await channel?.invokeMethod('start', args); } - ///Stops tracing and flushes tracing data to the specified output stream. - ///The data is sent to the specified output stream in json format typically in - ///chunks. - /// - ///Returns `false` if the WebView framework was not tracing at the time of the call, - ///`true` otherwise. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - TracingController.stop](https://developer.android.com/reference/android/webkit/TracingController#stop(java.io.OutputStream,%20java.util.concurrent.Executor))) + @override Future stop({String? filePath}) async { Map args = {}; args.putIfAbsent("filePath", () => filePath); return await channel?.invokeMethod('stop', args) ?? false; } - ///Returns whether the WebView framework is tracing. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - TracingController.isTracing](https://developer.android.com/reference/android/webkit/TracingController#isTracing())) + @override Future isTracing() async { Map args = {}; return await channel?.invokeMethod('isTracing', args) ?? false; diff --git a/flutter_inappwebview_android/lib/src/web_message/web_message_channel.dart b/flutter_inappwebview_android/lib/src/web_message/web_message_channel.dart index b04ce250..9af87309 100644 --- a/flutter_inappwebview_android/lib/src/web_message/web_message_channel.dart +++ b/flutter_inappwebview_android/lib/src/web_message/web_message_channel.dart @@ -30,12 +30,7 @@ class AndroidWebMessageChannelCreationParams } } -///The representation of the [HTML5 message channels](https://html.spec.whatwg.org/multipage/web-messaging.html#message-channels). -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformWebMessageChannel} class AndroidWebMessageChannel extends PlatformWebMessageChannel with ChannelController { /// Constructs a [AndroidWebMessageChannel]. @@ -60,6 +55,7 @@ class AndroidWebMessageChannel extends PlatformWebMessageChannel port2: AndroidWebMessagePort( AndroidWebMessagePortCreationParams(index: 1)))); + /// Provide static access. factory AndroidWebMessageChannel.static() { return _staticValue; } @@ -108,7 +104,6 @@ class AndroidWebMessageChannel extends PlatformWebMessageChannel return _fromMap(map); } - ///Disposes the web message channel. @override void dispose() { disposeChannel(); diff --git a/flutter_inappwebview_android/lib/src/web_message/web_message_listener.dart b/flutter_inappwebview_android/lib/src/web_message/web_message_listener.dart index 2c9baa79..00307c9a 100644 --- a/flutter_inappwebview_android/lib/src/web_message/web_message_listener.dart +++ b/flutter_inappwebview_android/lib/src/web_message/web_message_listener.dart @@ -36,12 +36,7 @@ class AndroidWebMessageListenerCreationParams } } -///This listener receives messages sent on the JavaScript object which was injected by [InAppWebViewController.addWebMessageListener]. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformWebMessageListener} class AndroidWebMessageListener extends PlatformWebMessageListener with ChannelController { /// Constructs a [AndroidWebMessageListener]. @@ -99,6 +94,7 @@ class AndroidWebMessageListener extends PlatformWebMessageListener disposeChannel(); } + @override Map toMap() { return { "id": _id, @@ -107,6 +103,7 @@ class AndroidWebMessageListener extends PlatformWebMessageListener }; } + @override Map toJson() { return this.toMap(); } @@ -139,11 +136,7 @@ class AndroidJavaScriptReplyProxyCreationParams } } -///This class represents the JavaScript object injected by [InAppWebViewController.addWebMessageListener]. -///An instance will be given by [AndroidWebMessageListener.onPostMessage]. -///The app can use `postMessage(String)` to talk to the JavaScript context. -/// -///There is a 1:1 relationship between this object and the JavaScript object in a frame. +///{@macro flutter_inappwebview_platform_interface.JavaScriptReplyProxy} class AndroidJavaScriptReplyProxy extends PlatformJavaScriptReplyProxy { /// Constructs a [AndroidWebMessageListener]. AndroidJavaScriptReplyProxy(PlatformJavaScriptReplyProxyCreationParams params) @@ -157,11 +150,7 @@ class AndroidJavaScriptReplyProxy extends PlatformJavaScriptReplyProxy { AndroidWebMessageListener get _androidWebMessageListener => params.webMessageListener as AndroidWebMessageListener; - ///Post a [message] to the injected JavaScript object which sent this [AndroidJavaScriptReplyProxy]. - /// - ///If [message] is of type [WebMessageType.ARRAY_BUFFER], be aware that large byte buffers can lead to out-of-memory crashes on low-end devices. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/JavaScriptReplyProxy#postMessage(java.lang.String) + @override Future postMessage(WebMessage message) async { Map args = {}; args.putIfAbsent('message', () => message.toMap()); diff --git a/flutter_inappwebview_android/lib/src/web_message/web_message_port.dart b/flutter_inappwebview_android/lib/src/web_message/web_message_port.dart index 8d66fdf9..f8979f5c 100644 --- a/flutter_inappwebview_android/lib/src/web_message/web_message_port.dart +++ b/flutter_inappwebview_android/lib/src/web_message/web_message_port.dart @@ -28,24 +28,7 @@ class AndroidWebMessagePortCreationParams } } -///The representation of the [HTML5 message ports](https://html.spec.whatwg.org/multipage/comms.html#messageport). -/// -///A Message port represents one endpoint of a Message Channel. In Android webview, there is no separate Message Channel object. -///When a message channel is created, both ports are tangled to each other and started. -///See [InAppWebViewController.createWebMessageChannel] for creating a message channel. -/// -///When a message port is first created or received via transfer, it does not have a [WebMessageCallback] to receive web messages. -///On Android, the messages are queued until a [WebMessageCallback] is set. -/// -///A message port should be closed when it is not used by the embedder application anymore. -///A closed port cannot be transferred or cannot be reopened to send messages. -///Close can be called multiple times. -/// -///When a port is transferred to JavaScript, it cannot be used to send or receive messages at the Dart side anymore. -///Different from HTML5 Spec, a port cannot be transferred if one of these has ever happened: i. a message callback was set, ii. a message was posted on it. -///A transferred port cannot be closed by the application, since the ownership is also transferred. -/// -///It is possible to transfer both ports of a channel to JavaScript, for example for communication between subframes. +///{@macro flutter_inappwebview_platform_interface.PlatformWebMessagePort} class AndroidWebMessagePort extends PlatformWebMessagePort { WebMessageCallback? _onMessage; late AndroidWebMessageChannel _webMessageChannel; @@ -59,7 +42,7 @@ class AndroidWebMessagePort extends PlatformWebMessagePort { .fromPlatformWebMessagePortCreationParams(params), ); - ///Sets a callback to receive message events on the main thread. + @override Future setWebMessageCallback(WebMessageCallback? onMessage) async { Map args = {}; args.putIfAbsent('index', () => params.index); @@ -68,7 +51,7 @@ class AndroidWebMessagePort extends PlatformWebMessagePort { this._onMessage = onMessage; } - ///Post a WebMessage to the entangled port. + @override Future postMessage(WebMessage message) async { Map args = {}; args.putIfAbsent('index', () => params.index); @@ -76,13 +59,14 @@ class AndroidWebMessagePort extends PlatformWebMessagePort { await _webMessageChannel.internalChannel?.invokeMethod('postMessage', args); } - ///Close the message port and free any resources associated with it. + @override Future close() async { Map args = {}; args.putIfAbsent('index', () => params.index); await _webMessageChannel.internalChannel?.invokeMethod('close', args); } + @override Map toMap() { return { "index": params.index, @@ -90,6 +74,7 @@ class AndroidWebMessagePort extends PlatformWebMessagePort { }; } + @override Map toJson() { return toMap(); } diff --git a/flutter_inappwebview_android/lib/src/web_storage/web_storage.dart b/flutter_inappwebview_android/lib/src/web_storage/web_storage.dart index fb068852..efafb429 100644 --- a/flutter_inappwebview_android/lib/src/web_storage/web_storage.dart +++ b/flutter_inappwebview_android/lib/src/web_storage/web_storage.dart @@ -25,14 +25,7 @@ class AndroidWebStorageCreationParams extends PlatformWebStorageCreationParams { } } -///Class that 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`. -///It used by [InAppWebViewController.webStorage]. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS -///- Web +///{@macro flutter_inappwebview_platform_interface.PlatformWebStorage} class AndroidWebStorage extends PlatformWebStorage { /// Constructs a [AndroidWebStorage]. AndroidWebStorage(PlatformWebStorageCreationParams params) @@ -43,11 +36,12 @@ class AndroidWebStorage extends PlatformWebStorage { .fromPlatformWebStorageCreationParams(params), ); + @override PlatformLocalStorage get localStorage => params.localStorage; + @override PlatformSessionStorage get sessionStorage => params.sessionStorage; - ///Disposes the web storage. @override void dispose() { localStorage.dispose(); @@ -73,8 +67,7 @@ class AndroidStorageCreationParams extends PlatformStorageCreationParams { } } -///Class that provides methods to manage the JavaScript [Storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage) object. -///It is used by [AndroidLocalStorage] and [AndroidSessionStorage]. +///{@macro flutter_inappwebview_platform_interface.PlatformStorage} class AndroidStorage extends PlatformStorage { /// Constructs a [AndroidStorage]. AndroidStorage(PlatformStorageCreationParams params) @@ -87,14 +80,7 @@ class AndroidStorage extends PlatformStorage { AndroidInAppWebViewController? _controller; - ///Returns an integer representing the number of data items stored in the Storage object. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future length() async { var result = await _controller?.evaluateJavascript(source: """ window.$webStorageType.length; @@ -102,14 +88,7 @@ class AndroidStorage extends PlatformStorage { return result != null ? int.parse(json.decode(result)) : null; } - ///When passed a [key] name and [value], will add that key to the storage, or update that key's value if it already exists. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future setItem({required String key, required dynamic value}) async { var encodedValue = json.encode(value); await _controller?.evaluateJavascript(source: """ @@ -117,14 +96,7 @@ class AndroidStorage extends PlatformStorage { """); } - ///When passed a [key] name, will return that key's value, or `null` if the key does not exist, in the given Storage object. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future getItem({required String key}) async { var itemValue = await _controller?.evaluateJavascript(source: """ window.$webStorageType.getItem("$key"); @@ -141,28 +113,14 @@ class AndroidStorage extends PlatformStorage { return itemValue; } - ///When passed a [key] name, will remove that key from the given Storage object if it exists. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future removeItem({required String key}) async { await _controller?.evaluateJavascript(source: """ window.$webStorageType.removeItem("$key"); """); } - ///Returns the list of all items from the given Storage object. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future> getItems() async { var webStorageItems = []; @@ -195,29 +153,14 @@ class AndroidStorage extends PlatformStorage { return webStorageItems; } - ///Clears all keys stored in a given Storage object. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future clear() async { await _controller?.evaluateJavascript(source: """ window.$webStorageType.clear(); """); } - ///When passed a number [index], returns the name of the nth key in a given Storage object. - ///The order of keys is user-agent defined, so you should not rely on it. - /// - ///**NOTE for Web**: this method will have effect only if the iframe has the same origin. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView - ///- iOS - ///- Web + @override Future key({required int index}) async { var result = await _controller?.evaluateJavascript(source: """ window.$webStorageType.key($index); @@ -225,7 +168,6 @@ class AndroidStorage extends PlatformStorage { return result != null ? json.decode(result) : null; } - ///Disposes the storage. @override void dispose() { _controller = null; @@ -251,8 +193,7 @@ class AndroidLocalStorageCreationParams } } -///Class that provides methods to manage the JavaScript `window.localStorage` object. -///It used by [AndroidWebStorage]. +///{@macro flutter_inappwebview_platform_interface.PlatformLocalStorage} class AndroidLocalStorage extends AndroidStorage implements PlatformLocalStorage { /// Constructs a [AndroidLocalStorage]. @@ -291,8 +232,7 @@ class AndroidSessionStorageCreationParams } } -///Class that provides methods to manage the JavaScript `window.sessionStorage` object. -///It used by [AndroidWebStorage]. +///{@macro flutter_inappwebview_platform_interface.PlatformSessionStorage} class AndroidSessionStorage extends AndroidStorage implements PlatformSessionStorage { /// Constructs a [AndroidSessionStorage]. diff --git a/flutter_inappwebview_android/lib/src/web_storage/web_storage_manager.dart b/flutter_inappwebview_android/lib/src/web_storage/web_storage_manager.dart index 2b8b88d9..07a128dc 100755 --- a/flutter_inappwebview_android/lib/src/web_storage/web_storage_manager.dart +++ b/flutter_inappwebview_android/lib/src/web_storage/web_storage_manager.dart @@ -26,16 +26,7 @@ class AndroidWebStorageManagerCreationParams } } -///Class that implements a singleton object (shared instance) which manages the web storage used by WebView instances. -///On Android, it is implemented using [WebStorage](https://developer.android.com/reference/android/webkit/WebStorage.html). -///On iOS and MacOS, it is implemented using [WKWebsiteDataStore.default()](https://developer.apple.com/documentation/webkit/wkwebsitedatastore). -/// -///**NOTE for iOS**: available from iOS 9.0+. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformWebStorageManager} class AndroidWebStorageManager extends PlatformWebStorageManager with ChannelController { /// Creates a new [AndroidWebStorageManager]. @@ -67,10 +58,7 @@ class AndroidWebStorageManager extends PlatformWebStorageManager Future _handleMethod(MethodCall call) async {} - ///Gets the origins currently using either the Application Cache or Web SQL Database APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebStorage.getOrigins](https://developer.android.com/reference/android/webkit/WebStorage#getOrigins(android.webkit.ValueCallback%3Cjava.util.Map%3E))) + @override Future> getOrigins() async { List originsList = []; @@ -90,57 +78,34 @@ class AndroidWebStorageManager extends PlatformWebStorageManager return originsList; } - ///Clears all storage currently being used by the JavaScript storage APIs. - ///This includes the Application Cache, Web SQL Database and the HTML5 Web Storage APIs. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebStorage.deleteAllData](https://developer.android.com/reference/android/webkit/WebStorage#deleteAllData())) + @override Future deleteAllData() async { Map args = {}; await channel?.invokeMethod('deleteAllData', args); } - ///Clears the storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin]. - ///The origin is specified using its string representation. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebStorage.deleteOrigin](https://developer.android.com/reference/android/webkit/WebStorage#deleteOrigin(java.lang.String))) + @override Future deleteOrigin({required String origin}) async { Map args = {}; args.putIfAbsent("origin", () => origin); await channel?.invokeMethod('deleteOrigin', args); } - ///Gets the storage quota for the Web SQL Database API for the given [origin]. - ///The quota is given in bytes and the origin is specified using its string representation. - ///Note that a quota is not enforced on a per-origin basis for the Application Cache API. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebStorage.getQuotaForOrigin](https://developer.android.com/reference/android/webkit/WebStorage#getQuotaForOrigin(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.Long%3E))) + @override Future getQuotaForOrigin({required String origin}) async { Map args = {}; args.putIfAbsent("origin", () => origin); return await channel?.invokeMethod('getQuotaForOrigin', args) ?? 0; } - ///Gets the amount of storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin]. - ///The amount is given in bytes and the origin is specified using its string representation. - /// - ///**Supported Platforms/Implementations**: - ///- Android native WebView ([Official API - WebStorage.getUsageForOrigin](https://developer.android.com/reference/android/webkit/WebStorage#getUsageForOrigin(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.Long%3E))) + @override Future getUsageForOrigin({required String origin}) async { Map args = {}; args.putIfAbsent("origin", () => origin); return await channel?.invokeMethod('getUsageForOrigin', args) ?? 0; } - ///Fetches data records containing the given website data types. - /// - ///[dataTypes] represents the website data types to fetch records for. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - WKWebsiteDataStore.fetchDataRecords](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532932-fetchdatarecords)) - ///- MacOS ([Official API - WKWebsiteDataStore.fetchDataRecords](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532932-fetchdatarecords)) + @override Future> fetchDataRecords( {required Set dataTypes}) async { List recordList = []; @@ -169,15 +134,7 @@ class AndroidWebStorageManager extends PlatformWebStorageManager return recordList; } - ///Removes website data of the given types for the given data records. - /// - ///[dataTypes] represents the website data types that should be removed. - /// - ///[dataRecords] represents the website data records to delete website data for. - /// - ///**Supported Platforms/Implementations**: - ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata)) - ///- MacOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata)) + @override Future removeDataFor( {required Set dataTypes, required List dataRecords}) async { @@ -197,15 +154,7 @@ class AndroidWebStorageManager extends PlatformWebStorageManager await channel?.invokeMethod('removeDataFor', args); } - ///Removes all website data of the given types that has been modified since the given date. - /// - ///[dataTypes] represents the website data types that should be removed. - /// - ///[date] represents a date. All website data modified after this date will be removed. - /// - ///**Supported Platforms/Implementations**: - ///- 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)) + @override Future removeDataModifiedSince( {required Set dataTypes, required DateTime date}) async { List dataTypesList = []; diff --git a/flutter_inappwebview_android/lib/src/webview_asset_loader.dart b/flutter_inappwebview_android/lib/src/webview_asset_loader.dart index cc754767..bb555364 100644 --- a/flutter_inappwebview_android/lib/src/webview_asset_loader.dart +++ b/flutter_inappwebview_android/lib/src/webview_asset_loader.dart @@ -24,9 +24,7 @@ class AndroidPathHandlerCreationParams } } -///A handler that produces responses for a registered path. -/// -///Implement this interface to handle other use-cases according to your app's needs. +///{@macro flutter_inappwebview_platform_interface.PlatformPathHandler} class AndroidPathHandler extends PlatformPathHandler with ChannelController { /// Creates a new [AndroidPathHandler]. AndroidPathHandler(PlatformPathHandlerCreationParams params) @@ -57,12 +55,12 @@ class AndroidPathHandler extends PlatformPathHandler with ChannelController { } } - ///Converts instance to a map. + @override Map toMap() { return {"path": path, "type": _type, "id": _id}; } - ///Converts instance to a map. + @override Map toJson() { return toMap(); } @@ -101,19 +99,7 @@ class AndroidAssetsPathHandlerCreationParams } } -///Handler class to open a file from assets directory in the application APK. -/// -///Opens the requested file from the application's assets directory. -/// -///The matched prefix path used shouldn't be a prefix of a real web path. -///Thus, if the requested file cannot be found a [WebResourceResponse] object with a `null` data will be returned instead of `null`. -///This saves the time of falling back to network and trying to resolve a path that doesn't exist. -///A [WebResourceResponse] with `null` data will be received as an HTTP response with status code `404` and no body. -/// -///The MIME type for the file will be determined from the file's extension using -///[guessContentTypeFromName](https://developer.android.com/reference/java/net/URLConnection.html#guessContentTypeFromName-java.lang.String-). -///Developers should ensure that asset files are named using standard file extensions. -///If the file does not have a recognised extension, `text/plain` will be used by default. +///{@macro flutter_inappwebview_platform_interface.PlatformAssetsPathHandler} class AndroidAssetsPathHandler extends AndroidPathHandler implements PlatformAssetsPathHandler { /// Constructs a [AndroidAssetsPathHandler]. @@ -148,19 +134,7 @@ class AndroidResourcesPathHandlerCreationParams } } -///Handler class to open a file from resources directory in the application APK. -/// -///Opens the requested file from application's resources directory. -/// -///The matched prefix path used shouldn't be a prefix of a real web path. -///Thus, if the requested file cannot be found a [WebResourceResponse] object with a `null` data will be returned instead of `null`. -///This saves the time of falling back to network and trying to resolve a path that doesn't exist. -///A [WebResourceResponse] with `null` data will be received as an HTTP response with status code `404` and no body. -/// -///The MIME type for the file will be determined from the file's extension using -///[guessContentTypeFromName](https://developer.android.com/reference/java/net/URLConnection.html#guessContentTypeFromName-java.lang.String-). -///Developers should ensure that asset files are named using standard file extensions. -///If the file does not have a recognised extension, `text/plain` will be used by default. +///{@macro flutter_inappwebview_platform_interface.PlatformResourcesPathHandler} class AndroidResourcesPathHandler extends AndroidPathHandler implements PlatformResourcesPathHandler { /// Constructs a [AndroidResourcesPathHandler]. @@ -195,24 +169,7 @@ class AndroidInternalStoragePathHandlerCreationParams } } -///Handler class to open files from application internal storage. -///For more information about android storage please refer to -///[Android Developers Docs: Data and file storage overview](https://developer.android.com/guide/topics/data/data-storage). -/// -///To avoid leaking user or app data to the web, make sure to choose [directory] carefully, -///and assume any file under this directory could be accessed by any web page subject to same-origin rules. -/// -///Opens the requested file from the exposed data directory. -/// -///The matched prefix path used shouldn't be a prefix of a real web path. -///Thus, if the requested file cannot be found a [WebResourceResponse] object with a `null` data will be returned instead of `null`. -///This saves the time of falling back to network and trying to resolve a path that doesn't exist. -///A [WebResourceResponse] with `null` data will be received as an HTTP response with status code `404` and no body. -/// -///The MIME type for the file will be determined from the file's extension using -///[guessContentTypeFromName](https://developer.android.com/reference/java/net/URLConnection.html#guessContentTypeFromName-java.lang.String-). -///Developers should ensure that asset files are named using standard file extensions. -///If the file does not have a recognised extension, `text/plain` will be used by default. +///{@macro flutter_inappwebview_platform_interface.PlatformInternalStoragePathHandler} class AndroidInternalStoragePathHandler extends AndroidPathHandler implements PlatformInternalStoragePathHandler { /// Constructs a [AndroidInternalStoragePathHandler]. diff --git a/flutter_inappwebview_android/lib/src/webview_feature.dart b/flutter_inappwebview_android/lib/src/webview_feature.dart index 7d2bbf3b..9b149510 100644 --- a/flutter_inappwebview_android/lib/src/webview_feature.dart +++ b/flutter_inappwebview_android/lib/src/webview_feature.dart @@ -25,10 +25,7 @@ class AndroidWebViewFeatureCreationParams } } -///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView +///{@macro flutter_inappwebview_platform_interface.PlatformWebViewFeature} class AndroidWebViewFeature extends PlatformWebViewFeature with ChannelController { /// Creates a new [AndroidWebViewFeature]. @@ -64,19 +61,7 @@ class AndroidWebViewFeature extends PlatformWebViewFeature Future _handleMethod(MethodCall call) async {} - ///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher, - ///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device, - ///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`. - /// - ///**Note**: This method is different from [isStartupFeatureSupported] and this - ///method only accepts certain features. - ///Please verify that the correct feature checking method is used for a particular feature. - /// - ///**Note**: If this method returns `false`, it is not safe to invoke the methods - ///requiring the desired feature. - ///Furthermore, if this method returns `false` for a particular feature, any callback guarded by that feature will not be invoked. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String) + @override Future isFeatureSupported(WebViewFeature feature) async { Map args = {}; args.putIfAbsent("feature", () => feature.toNativeValue()); @@ -84,21 +69,7 @@ class AndroidWebViewFeature extends PlatformWebViewFeature false; } - ///Return whether a startup feature is supported at run-time. - ///On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher, - ///this will check whether a startup feature is supported, - ///depending on the combination of the desired feature, - ///the Android version of device, and the WebView APK on the device. - ///If running on a device with a lower API level, this will always return `false`. - /// - ///**Note**: This method is different from [isFeatureSupported] and this method only accepts startup features. - ///Please verify that the correct feature checking method is used for a particular feature. - /// - ///**Note**: If this method returns `false`, it is not safe to invoke the methods requiring the desired feature. - ///Furthermore, if this method returns `false` for a particular feature, - ///any callback guarded by that feature will not be invoked. - /// - ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String) + @override Future isStartupFeatureSupported(WebViewFeature startupFeature) async { Map args = {}; args.putIfAbsent("startupFeature", () => startupFeature.toNativeValue()); diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_action_button.g.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_action_button.g.dart index 663b1435..ef981f4b 100644 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_action_button.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_action_button.g.dart @@ -10,7 +10,7 @@ part of 'chrome_safari_action_button.dart'; /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView class ChromeSafariBrowserActionButton { ///Use onClick instead. @@ -35,7 +35,7 @@ class ChromeSafariBrowserActionButton { /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ChromeSafariBrowserActionButton( {required this.id, diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_menu_item.g.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_menu_item.g.dart index 7b524976..9bb9f017 100644 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_menu_item.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_menu_item.g.dart @@ -10,7 +10,7 @@ part of 'chrome_safari_browser_menu_item.dart'; /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS class ChromeSafariBrowserMenuItem { @@ -33,7 +33,7 @@ class ChromeSafariBrowserMenuItem { /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ChromeSafariBrowserMenuItem( diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_secondary_toolbar.g.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_secondary_toolbar.g.dart index a829e024..7b1a7a3e 100644 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_secondary_toolbar.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_secondary_toolbar.g.dart @@ -17,7 +17,7 @@ part of 'chrome_safari_browser_secondary_toolbar.dart'; /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView class ChromeSafariBrowserSecondaryToolbar { ///The IDs of clickable views. The `onClick` event of these views will be handled by custom tabs. @@ -29,7 +29,7 @@ class ChromeSafariBrowserSecondaryToolbar { /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ChromeSafariBrowserSecondaryToolbar( {this.clickableIDs = const [], required this.layout}); @@ -74,7 +74,7 @@ class ChromeSafariBrowserSecondaryToolbar { /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView class ChromeSafariBrowserSecondaryToolbarClickableID { ///The android id resource @@ -86,7 +86,7 @@ class ChromeSafariBrowserSecondaryToolbarClickableID { /// ///**NOTE for Android native WebView**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ChromeSafariBrowserSecondaryToolbarClickableID( {required this.id, this.onClick}); diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart index 6ba48813..b8d6610c 100755 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart @@ -62,7 +62,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android CustomTabsShareState_? shareState; @@ -70,31 +70,31 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? showTitle; ///Set the custom background color of the toolbar. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color_? toolbarBackgroundColor; ///Sets the navigation bar color. Has no effect on Android API versions below L. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color_? navigationBarColor; ///Sets the navigation bar divider color. Has no effect on Android API versions below P. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color_? navigationBarDividerColor; ///Sets the color of the secondary toolbar. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color_? secondaryToolbarColor; @@ -102,7 +102,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? enableUrlBarHiding; @@ -110,7 +110,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? instantAppsEnabled; @@ -120,31 +120,31 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { ///If non-null, the Intent can only match the components in the given ///application package. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android String? packageName; ///Set to `true` to enable Keep Alive. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? keepAliveEnabled; ///Set to `true` to launch the Android activity in `singleInstance` mode. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? isSingleInstance; ///Set to `true` to launch the Android intent with the flag `FLAG_ACTIVITY_NO_HISTORY`. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? noHistory; ///Set to `true` to launch the Custom Tab as a Trusted Web Activity. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? isTrustedWebActivity; @@ -152,7 +152,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? additionalTrustedOrigins; @@ -160,7 +160,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android @ExchangeableObjectProperty(deserializer: _deserializeDisplayMode) TrustedWebActivityDisplayMode_? displayMode; @@ -169,7 +169,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android TrustedWebActivityScreenOrientation_? screenOrientation; @@ -177,7 +177,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { ///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the browser ///and the second one represents the "exit" animation for the application. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? startAnimations; @@ -185,7 +185,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { ///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the application ///and the second one represents the "exit" animation for the browser. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? exitAnimations; @@ -194,19 +194,19 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { ///Calling this with an intent will override any custom tabs related customizations. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? alwaysUseBrowserUI; ///Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? entersReaderIfAvailable; ///Set to `true` to enable bar collapsing. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? barCollapsingEnabled; @@ -214,7 +214,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 11.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS DismissButtonStyle_? dismissButtonStyle; @@ -222,7 +222,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 10.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? preferredBarTintColor; @@ -230,19 +230,19 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 10.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? preferredControlTintColor; ///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalPresentationStyle_? presentationStyle; ///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalTransitionStyle_? transitionStyle; @@ -251,7 +251,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 15.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ActivityButton_? activityButton; @@ -260,7 +260,7 @@ class ChromeSafariBrowserSettings_ implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 15.2+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS UIEventAttribution_? eventAttribution; diff --git a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.g.dart b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.g.dart index 165d6b29..4ec95401 100644 --- a/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/chrome_safari_browser/chrome_safari_browser_settings.g.dart @@ -13,7 +13,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 15.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ActivityButton? activityButton; @@ -21,7 +21,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? additionalTrustedOrigins; @@ -30,13 +30,13 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { ///Calling this with an intent will override any custom tabs related customizations. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? alwaysUseBrowserUI; ///Set to `true` to enable bar collapsing. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? barCollapsingEnabled; @@ -44,7 +44,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 11.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS DismissButtonStyle? dismissButtonStyle; @@ -52,7 +52,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android TrustedWebActivityDisplayMode? displayMode; @@ -60,13 +60,13 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? enableUrlBarHiding; ///Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? entersReaderIfAvailable; @@ -75,7 +75,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 15.2+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS UIEventAttribution? eventAttribution; @@ -83,7 +83,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { ///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the application ///and the second one represents the "exit" animation for the browser. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? exitAnimations; @@ -91,43 +91,43 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? instantAppsEnabled; ///Set to `true` to launch the Android activity in `singleInstance` mode. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? isSingleInstance; ///Set to `true` to launch the Custom Tab as a Trusted Web Activity. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? isTrustedWebActivity; ///Set to `true` to enable Keep Alive. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? keepAliveEnabled; ///Sets the navigation bar color. Has no effect on Android API versions below L. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color? navigationBarColor; ///Sets the navigation bar divider color. Has no effect on Android API versions below P. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color? navigationBarDividerColor; ///Set to `true` to launch the Android intent with the flag `FLAG_ACTIVITY_NO_HISTORY`. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? noHistory; @@ -137,7 +137,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { ///If non-null, the Intent can only match the components in the given ///application package. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android String? packageName; @@ -145,7 +145,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 10.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? preferredBarTintColor; @@ -153,13 +153,13 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: available on iOS 10.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? preferredControlTintColor; ///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalPresentationStyle? presentationStyle; @@ -167,13 +167,13 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Available only in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android TrustedWebActivityScreenOrientation? screenOrientation; ///Sets the color of the secondary toolbar. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color? secondaryToolbarColor; @@ -181,7 +181,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android CustomTabsShareState? shareState; @@ -189,7 +189,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android bool? showTitle; @@ -197,19 +197,19 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { ///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the browser ///and the second one represents the "exit" animation for the application. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android List? startAnimations; ///Set the custom background color of the toolbar. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android Color? toolbarBackgroundColor; ///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalTransitionStyle? transitionStyle; ChromeSafariBrowserSettings( 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 e0c09869..af26858d 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 @@ -14,6 +14,12 @@ class PlatformChromeSafariBrowserCreationParams { const PlatformChromeSafariBrowserCreationParams(); } +///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser} +///Class that provides a visible standard interface for browsing the web. +///It presents a self-contained web interface inside your app. +/// +///If you need to customize or interact with the web content, use the `InAppWebView` widget. +/// ///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android ///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS. /// @@ -21,9 +27,10 @@ class PlatformChromeSafariBrowserCreationParams { ///`android.support.customtabs.action.CustomTabsService` in your `AndroidManifest.xml` ///(you can read more about it here: https://developers.google.com/web/android/custom-tabs/best-practices#applications_targeting_android_11_api_level_30_or_above). /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS +///{@endtemplate} abstract class PlatformChromeSafariBrowser extends PlatformInterface implements Disposable { ///Debug settings. @@ -85,6 +92,7 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// The parameters used to initialize the [PlatformChromeSafariBrowser]. final PlatformChromeSafariBrowserCreationParams params; + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.open} ///Opens the [PlatformChromeSafariBrowser] instance with an [url]. /// ///[url] - The [url] to load. On iOS, the [url] is required and must use the `http` or `https` scheme. @@ -101,9 +109,10 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///[settings] - Settings for the [PlatformChromeSafariBrowser]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} Future open( {WebUri? url, Map? headers, @@ -116,6 +125,7 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface throw UnimplementedError('open is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.launchUrl} ///Tells the browser to launch with [url]. /// ///[url] - initial url. @@ -128,8 +138,9 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///[referrer] - referrer header. Supported only on Android. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android + ///{@endtemplate} Future launchUrl({ required WebUri url, Map? headers, @@ -140,6 +151,7 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface 'launchUrl is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.mayLaunchUrl} ///Tells the browser of a likely future navigation to a URL. ///The most likely URL has to be specified first. ///Optionally, a list of other likely URLs can be provided. @@ -150,19 +162,21 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E))) + ///{@endtemplate} Future mayLaunchUrl({WebUri? url, List? otherLikelyURLs}) { throw UnimplementedError( 'mayLaunchUrl is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.validateRelationship} ///Requests to validate a relationship between the application and an origin. /// ///See [here](https://developers.google.com/digital-asset-links/v1/getting-started) for documentation about Digital Asset Links. ///This methods requests the browser to verify a relation with the calling application, to grant the associated rights. /// - ///If this method returns `true`, the validation result will be provided through [onRelationshipValidationResult]. + ///If this method returns `true`, the validation result will be provided through [PlatformChromeSafariBrowserEvents.onRelationshipValidationResult]. ///Otherwise the request didn't succeed. /// ///[relation] – Relation to check, must be one of the [CustomTabsRelationType] constants. @@ -171,95 +185,111 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///[extras] – Reserved for future use. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle))) + ///{@endtemplate} Future validateRelationship( {required CustomTabsRelationType relation, required WebUri origin}) { throw UnimplementedError( 'validateRelationship is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.close} ///Closes the [PlatformChromeSafariBrowser] instance. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} Future close() { throw UnimplementedError( 'close is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.setActionButton} ///Set a custom action button. /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean))) + ///{@endtemplate} void setActionButton(ChromeSafariBrowserActionButton actionButton) { throw UnimplementedError( 'setActionButton is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.updateActionButton} ///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description]. /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String))) + ///{@endtemplate} Future updateActionButton( {required Uint8List icon, required String description}) { throw UnimplementedError( 'updateActionButton is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.setSecondaryToolbar} ///Sets the remote views displayed in the secondary toolbar in a custom tab. /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) + ///{@endtemplate} void setSecondaryToolbar( ChromeSafariBrowserSecondaryToolbar secondaryToolbar) { throw UnimplementedError( 'setSecondaryToolbar is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.updateSecondaryToolbar} ///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session. /// ///**NOTE**: Not available in a Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) + ///{@endtemplate} Future updateSecondaryToolbar( ChromeSafariBrowserSecondaryToolbar secondaryToolbar) { throw UnimplementedError( 'updateSecondaryToolbar is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.addMenuItem} ///Adds a [ChromeSafariBrowserMenuItem] to the menu. /// ///**NOTE**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} void addMenuItem(ChromeSafariBrowserMenuItem menuItem) { throw UnimplementedError( 'addMenuItem is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.addMenuItems} ///Adds a list of [ChromeSafariBrowserMenuItem] to the menu. /// ///**NOTE**: Not available in an Android Trusted Web Activity. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} void addMenuItems(List menuItems) { throw UnimplementedError( 'addMenuItems is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.requestPostMessageChannel} ///Sends a request to create a two way postMessage channel between the client ///and the browser. ///If you want to specifying the target origin to communicate with, set the [targetOrigin]. @@ -275,74 +305,86 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface ///Note that returning true here doesn't mean an origin has already been ///assigned as the validation is asynchronous. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle))) + ///{@endtemplate} Future requestPostMessageChannel( {required WebUri sourceOrigin, WebUri? targetOrigin}) { throw UnimplementedError( 'requestPostMessageChannel is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.postMessage} ///Sends a postMessage request using the origin communicated via [requestPostMessageChannel]. - ///Fails when called before [onMessageChannelReady] event. + ///Fails when called before [PlatformChromeSafariBrowserEvents.onMessageChannelReady] event. /// ///[message] – The message that is being sent. /// ///Returns an integer constant about the postMessage request result. ///Will return CustomTabsService.RESULT_SUCCESS if successful. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle))) + ///{@endtemplate} Future postMessage(String message) { throw UnimplementedError( 'postMessage is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.isEngagementSignalsApiAvailable} ///Returns whether the Engagement Signals API is available. ///The availability of the Engagement Signals API may change at runtime. - ///If an EngagementSignalsCallback has been set, an [onSessionEnded] + ///If an EngagementSignalsCallback has been set, an [PlatformChromeSafariBrowserEvents.onSessionEnded] ///signal will be sent if the API becomes unavailable later. /// ///Returns whether the Engagement Signals API is available. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle))) + ///{@endtemplate} Future isEngagementSignalsApiAvailable() { throw UnimplementedError( 'isEngagementSignalsApiAvailable is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.isOpened} ///Returns `true` if the [PlatformChromeSafariBrowser] instance is opened, otherwise `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} bool isOpened() { throw UnimplementedError( 'isOpened is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.isAvailable} ///On Android, returns `true` if Chrome Custom Tabs is available. ///On iOS, returns `true` if SFSafariViewController is available. ///Otherwise returns `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} Future isAvailable() { throw UnimplementedError( 'isAvailable is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.getMaxToolbarItems} ///The maximum number of allowed secondary toolbar items. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android + ///{@endtemplate} Future getMaxToolbarItems() { throw UnimplementedError( 'getMaxToolbarItems is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.getPackageName} ///Returns the preferred package to use for Custom Tabs. ///The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs. ///To modify this preferred behavior, set [ignoreDefault] to `true` and give a @@ -357,26 +399,30 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///Returns the preferred package name for handling Custom Tabs, or null. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean)))) + ///{@endtemplate} Future getPackageName( {List? packages, bool ignoreDefault = false}) { throw UnimplementedError( 'getPackageName is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.clearWebsiteData} ///Clear associated website data accrued from browsing activity within your app. ///This includes all local storage, cached resources, and cookies. /// ///**NOTE for iOS**: available on iOS 16.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata)) + ///{@endtemplate} Future clearWebsiteData() { throw UnimplementedError( 'clearWebsiteData is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.prewarmConnections} ///Prewarms a connection to each URL. SFSafariViewController will automatically use a ///prewarmed connection if possible when loading its initial URL. /// @@ -395,25 +441,30 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface /// ///**NOTE for iOS**: available on iOS 15.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) + ///{@endtemplate} Future prewarmConnections(List URLs) { throw UnimplementedError( 'prewarmConnections is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.invalidatePrewarmingToken} ///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens. /// ///**NOTE for iOS**: available on iOS 15.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) + ///{@endtemplate} Future invalidatePrewarmingToken(PrewarmingToken prewarmingToken) { throw UnimplementedError( 'invalidatePrewarmingToken is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.dispose} ///Disposes the channel. + ///{@endtemplate} @override void dispose() { throw UnimplementedError( @@ -422,87 +473,108 @@ abstract class PlatformChromeSafariBrowser extends PlatformInterface } abstract class PlatformChromeSafariBrowserEvents { + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onServiceConnected} ///Event fired when the when connecting from Android Custom Tabs Service. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android + ///{@endtemplate} void onServiceConnected() {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onOpened} ///Event fired when the [PlatformChromeSafariBrowser] is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} void onOpened() {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onCompletedInitialLoad} ///Event fired when the initial URL load is complete. /// ///[didLoadSuccessfully] - `true` if loading completed successfully; otherwise, `false`. Supported only on iOS. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS ([Official API - SFSafariViewControllerDelegate.safariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontrollerdelegate/1621215-safariviewcontroller)) + ///{@endtemplate} void onCompletedInitialLoad(bool? didLoadSuccessfully) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onInitialLoadDidRedirect} ///Event fired when the initial URL load is complete. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - SFSafariViewControllerDelegate.safariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontrollerdelegate/2923545-safariviewcontroller)) + ///{@endtemplate} void onInitialLoadDidRedirect(WebUri? url) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onNavigationEvent} ///Event fired when a navigation event happens. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsCallback.onNavigationEvent](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback#onNavigationEvent(int,android.os.Bundle))) + ///{@endtemplate} void onNavigationEvent(CustomTabsNavigationEventType? navigationEvent) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onRelationshipValidationResult} ///Event fired when a relationship validation result is available. /// - ///[relation] - Relation for which the result is available. Value previously passed to [validateRelationship]. + ///[relation] - Relation for which the result is available. Value previously passed to [PlatformChromeSafariBrowser.validateRelationship]. /// - ///[requestedOrigin] - Origin requested. Value previously passed to [validateRelationship]. + ///[requestedOrigin] - Origin requested. Value previously passed to [PlatformChromeSafariBrowser.validateRelationship]. /// ///[result] - Whether the relation was validated. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsCallback.onRelationshipValidationResult](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback#onRelationshipValidationResult(int,android.net.Uri,boolean,android.os.Bundle))) + ///{@endtemplate} void onRelationshipValidationResult( CustomTabsRelationType? relation, WebUri? requestedOrigin, bool result) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onWillOpenInBrowser} ///Event fired when the user opens the current page in the default browser by tapping the toolbar button. /// ///**NOTE for iOS**: available on iOS 14.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - SFSafariViewControllerDelegate.safariViewControllerWillOpenInBrowser](https://developer.apple.com/documentation/safariservices/sfsafariviewcontrollerdelegate/3650426-safariviewcontrollerwillopeninbr)) + ///{@endtemplate} void onWillOpenInBrowser() {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onMessageChannelReady} ///Called when the [PlatformChromeSafariBrowser] has requested a postMessage channel through - ///[requestPostMessageChannel] and the channel is ready for sending and receiving messages on both ends. + ///[PlatformChromeSafariBrowser.requestPostMessageChannel] and the channel is ready for sending and receiving messages on both ends. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsCallback.onMessageChannelReady](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback#onMessageChannelReady(android.os.Bundle))) + ///{@endtemplate} void onMessageChannelReady() {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onPostMessage} ///Called when a tab controlled by this [PlatformChromeSafariBrowser] has sent a postMessage. - ///If [postMessage] is called from a single thread, then the messages will be posted in the same order. + ///If [PlatformChromeSafariBrowser.postMessage] is called from a single thread, then the messages will be posted in the same order. ///When received on the client side, it is the client's responsibility to preserve the ordering further. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - CustomTabsCallback.onPostMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback#onPostMessage(java.lang.String,android.os.Bundle))) + ///{@endtemplate} void onPostMessage(String message) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onVerticalScrollEvent} ///Called when a user scrolls the tab. /// ///[isDirectionUp] - `false` when the user scrolls farther down the page, ///and `true` when the user scrolls back up toward the top of the page. /// - ///**NOTE**: available only if [isEngagementSignalsApiAvailable] returns `true`. + ///**NOTE**: available only if [PlatformChromeSafariBrowser.isEngagementSignalsApiAvailable] returns `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - EngagementSignalsCallback.onVerticalScrollEvent](https://developer.android.com/reference/androidx/browser/customtabs/EngagementSignalsCallback#onVerticalScrollEvent(boolean,android.os.Bundle))) + ///{@endtemplate} void onVerticalScrollEvent(bool isDirectionUp) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onGreatestScrollPercentageIncreased} ///Called when a user has reached a greater scroll percentage on the page. The greatest scroll ///percentage is reset if the user navigates to a different page. If the current page's total ///height changes, this method will be called again only if the scroll progress reaches a @@ -511,27 +583,32 @@ abstract class PlatformChromeSafariBrowserEvents { ///[scrollPercentage] - An integer indicating the percent of scrollable progress ///the user hasmade down the current page. /// - ///**NOTE**: available only if [isEngagementSignalsApiAvailable] returns `true`. + ///**NOTE**: available only if [PlatformChromeSafariBrowser.isEngagementSignalsApiAvailable] returns `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - EngagementSignalsCallback.onGreatestScrollPercentageIncreased](https://developer.android.com/reference/androidx/browser/customtabs/EngagementSignalsCallback#onGreatestScrollPercentageIncreased(int,android.os.Bundle))) + ///{@endtemplate} void onGreatestScrollPercentageIncreased(int scrollPercentage) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onSessionEnded} ///Called when a `CustomTabsSession` is ending or when no further Engagement Signals ///callbacks are expected to report whether any user action has occurred during the session. /// ///[didUserInteract] - Whether the user has interacted with the page in any way, e.g. scrolling. /// - ///**NOTE**: available only if [isEngagementSignalsApiAvailable] returns `true`. + ///**NOTE**: available only if [PlatformChromeSafariBrowser.isEngagementSignalsApiAvailable] returns `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ([Official API - EngagementSignalsCallback.onSessionEnded](https://developer.android.com/reference/androidx/browser/customtabs/EngagementSignalsCallback#onSessionEnded(boolean,android.os.Bundle))) + ///{@endtemplate} void onSessionEnded(bool didUserInteract) {} + ///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.onClosed} ///Event fired when the [PlatformChromeSafariBrowser] is closed. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS + ///{@endtemplate} void onClosed() {} } diff --git a/flutter_inappwebview_platform_interface/lib/src/content_blocker.dart b/flutter_inappwebview_platform_interface/lib/src/content_blocker.dart index f4f34be0..6d6a6eb7 100755 --- a/flutter_inappwebview_platform_interface/lib/src/content_blocker.dart +++ b/flutter_inappwebview_platform_interface/lib/src/content_blocker.dart @@ -44,7 +44,7 @@ class ContentBlockerTrigger { ///A list of regular expressions to match iframes URL against. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ///- MacOS List ifFrameUrl; @@ -52,7 +52,7 @@ class ContentBlockerTrigger { ///A Boolean value indicating if the URL matching should be case-sensitive. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -62,7 +62,7 @@ class ContentBlockerTrigger { ///(how the browser intends to use the resource) that the rule should match. ///If not specified, the rule matches all resource types. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -72,7 +72,7 @@ class ContentBlockerTrigger { ///Values must be lowercase ASCII, or punycode for non-ASCII. ///Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.unlessDomain]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -82,7 +82,7 @@ class ContentBlockerTrigger { ///Values must be lowercase ASCII, or punycode for non-ASCII. ///Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.ifDomain]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -91,7 +91,7 @@ class ContentBlockerTrigger { ///A list of [ContentBlockerTriggerLoadType] that can include one of two mutually exclusive values. ///If not specified, the rule matches all load types. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -100,7 +100,7 @@ class ContentBlockerTrigger { ///A list of strings matched to the entire main document URL; limits the action to a specific list of URL patterns. ///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.unlessTopUrl]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -109,7 +109,7 @@ class ContentBlockerTrigger { ///An array of strings matched to the entire main document URL; acts on any site except URL patterns in provided list. ///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.ifTopUrl]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -117,7 +117,7 @@ class ContentBlockerTrigger { ///An array of strings that specify loading contexts. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ///- MacOS List loadContext; diff --git a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu.g.dart b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu.g.dart index c3b39050..84e63405 100644 --- a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu.g.dart @@ -10,7 +10,7 @@ part of 'context_menu.dart'; /// ///**NOTE for Android native WebView**: To make it work properly on Android, JavaScript should be enabled! /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS class ContextMenu { @@ -40,7 +40,7 @@ class ContextMenu { /// ///**NOTE for Android native WebView**: To make it work properly on Android, JavaScript should be enabled! /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ContextMenu( diff --git a/flutter_inappwebview_platform_interface/lib/src/find_interaction/platform_find_interaction_controller.dart b/flutter_inappwebview_platform_interface/lib/src/find_interaction/platform_find_interaction_controller.dart index f53d2e11..e84d2457 100644 --- a/flutter_inappwebview_platform_interface/lib/src/find_interaction/platform_find_interaction_controller.dart +++ b/flutter_inappwebview_platform_interface/lib/src/find_interaction/platform_find_interaction_controller.dart @@ -24,10 +24,15 @@ class PlatformFindInteractionControllerCreationParams { bool isDoneCounting)? onFindResultReceived; } -///**Supported Platforms/Implementations**: +///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController} +///This class represents the controller used by the `WebView` to add +///text-finding capabilities, such as the "Find on page" feature. +/// +///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS +///{@endtemplate} abstract class PlatformFindInteractionController extends PlatformInterface implements Disposable { ///Debug settings. @@ -75,7 +80,7 @@ abstract class PlatformFindInteractionController extends PlatformInterface /// ///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`, this event will not be called. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.FindListener.onFindResultReceived](https://developer.android.com/reference/android/webkit/WebView.FindListener#onFindResultReceived(int,%20int,%20boolean))) ///- iOS ///- MacOS @@ -84,6 +89,7 @@ abstract class PlatformFindInteractionController extends PlatformInterface int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting)? get onFindResultReceived => params.onFindResultReceived; + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.findAll} ///Finds all instances of find on the page and highlights them. Notifies [PlatformFindInteractionController.onFindResultReceived] listener. /// ///[find] represents the string to find. @@ -94,15 +100,17 @@ abstract class PlatformFindInteractionController extends PlatformInterface ///it uses the built-in find interaction native UI, ///otherwise this is implemented using CSS and Javascript. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.findAllAsync](https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String))) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2) with [Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- MacOS + ///{@endtemplate} Future findAll({String? find}) { throw UnimplementedError( 'findAll is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.findNext} ///Highlights and scrolls to the next match found by [findAll]. Notifies [PlatformFindInteractionController.onFindResultReceived] listener. /// ///[forward] represents the direction to search. The default value is `true`, meaning forward. @@ -111,113 +119,133 @@ abstract class PlatformFindInteractionController extends PlatformInterface ///it uses the built-in find interaction native UI, ///otherwise this is implemented using CSS and Javascript. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.findNext](https://developer.android.com/reference/android/webkit/WebView#findNext(boolean))) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.findNext](https://developer.apple.com/documentation/uikit/uifindinteraction/3975829-findnext?changes=_2) and ([Official API - UIFindInteraction.findPrevious](https://developer.apple.com/documentation/uikit/uifindinteraction/3975830-findprevious?changes=_2))) ///- MacOS + ///{@endtemplate} Future findNext({bool forward = true}) { throw UnimplementedError( 'findNext is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.clearMatches} ///Clears the highlighting surrounding text matches created by [findAll]. /// ///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`, ///it uses the built-in find interaction native UI, ///otherwise this is implemented using CSS and Javascript. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.clearMatches](https://developer.android.com/reference/android/webkit/WebView#clearMatches())) ///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2)) ///- MacOS + ///{@endtemplate} Future clearMatches() { throw UnimplementedError( 'clearMatches is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.setSearchText} ///Pre-populate the search text to be used. /// ///On iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true, ///it will pre-populate the system find panel's search text field with a search query. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- MacOS + ///{@endtemplate} Future setSearchText(String? searchText) { throw UnimplementedError( 'setSearchText is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.getSearchText} ///Get the search text used. /// ///On iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true, ///it will get the system find panel's search text field value. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ([Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2)) ///- MacOS + ///{@endtemplate} Future getSearchText() { throw UnimplementedError( 'getSearchText is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.isFindNavigatorVisible} ///A Boolean value that indicates when the find panel displays onscreen. /// ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - UIFindInteraction.isFindNavigatorVisible](https://developer.apple.com/documentation/uikit/uifindinteraction/3975828-isfindnavigatorvisible?changes=_2)) + ///{@endtemplate} Future isFindNavigatorVisible() { throw UnimplementedError( 'isFindNavigatorVisible is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.updateResultCount} ///Updates the results the interface displays for the active search. /// ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - UIFindInteraction.updateResultCount](https://developer.apple.com/documentation/uikit/uifindinteraction/3975835-updateresultcount?changes=_2)) + ///{@endtemplate} Future updateResultCount() { throw UnimplementedError( 'updateResultCount is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.presentFindNavigator} ///Begins a search, displaying the find panel. /// ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2)) + ///{@endtemplate} Future presentFindNavigator() { throw UnimplementedError( 'presentFindNavigator is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.dismissFindNavigator} ///Dismisses the find panel, if present. /// ///**NOTE**: available only on iOS and only if [InAppWebViewSettings.isFindInteractionEnabled] is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - UIFindInteraction.dismissFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975827-dismissfindnavigator?changes=_2)) + ///{@endtemplate} Future dismissFindNavigator() { throw UnimplementedError( 'dismissFindNavigator is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.getActiveFindSession} ///If there's a currently active find session, returns the active find session. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ([Official API - UIFindInteraction.activeFindSession](https://developer.apple.com/documentation/uikit/uifindinteraction/3975825-activefindsession?changes=_7____4_8&language=objc)) ///- MacOS + ///{@endtemplate} Future getActiveFindSession() { throw UnimplementedError( 'getActiveFindSession is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformFindInteractionController.dispose} + ///Disposes the controller. + ///{@endtemplate} @override void dispose() { throw UnimplementedError( diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_menu_item.g.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_menu_item.g.dart index 6fef0857..90620b74 100644 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_menu_item.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_menu_item.g.dart @@ -8,7 +8,7 @@ part of 'in_app_browser_menu_item.dart'; ///Class that represents a custom menu item for a [PlatformInAppBrowser] instance. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -18,7 +18,7 @@ class InAppBrowserMenuItem { ///Icon color. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS 13.0+ ///- MacOS @@ -40,7 +40,7 @@ class InAppBrowserMenuItem { String title; /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart index ab372cfe..c87aec88 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart @@ -100,7 +100,7 @@ class InAppBrowserSettings_ ///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -108,7 +108,7 @@ class InAppBrowserSettings_ ///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -116,7 +116,7 @@ class InAppBrowserSettings_ ///Set the custom background color of the toolbar at the top. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -124,7 +124,7 @@ class InAppBrowserSettings_ ///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -132,7 +132,7 @@ class InAppBrowserSettings_ ///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -140,137 +140,137 @@ class InAppBrowserSettings_ ///Set to `true` to hide the default menu items. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS bool? hideDefaultMenuItems; ///Set to `true` if you want the title should be displayed. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? hideTitleBar; ///Set the action bar's title. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- MacOS String? toolbarTopFixedTitle; ///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? closeOnCannotGoBack; ///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? allowGoBackWithBackButton; ///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? shouldCloseOnBackButtonPressed; ///Set to `true` to set the toolbar at the top translucent. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? toolbarTopTranslucent; ///Set the tint color to apply to the navigation bar background. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? toolbarTopBarTintColor; ///Set the tint color to apply to the navigation items and bar button items. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? toolbarTopTintColor; ///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? hideToolbarBottom; ///Set the custom background color of the toolbar at the bottom. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? toolbarBottomBackgroundColor; ///Set the tint color to apply to the bar button items. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? toolbarBottomTintColor; ///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? toolbarBottomTranslucent; ///Set the custom text for the close button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS String? closeButtonCaption; ///Set the custom color for the close button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? closeButtonColor; ///Set to `true` to hide the close button. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? hideCloseButton; ///Set the custom color for the menu button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color_? menuButtonColor; ///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalPresentationStyle_? presentationStyle; ///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalTransitionStyle_? transitionStyle; ///How the browser window should be added to the main window. ///The default value is [WindowType.CHILD]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowType_? windowType; ///The window’s alpha value. ///The default value is `1.0`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS double? windowAlphaValue; ///Flags that describe the window’s current style, such as if it’s resizable or in full-screen mode. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowStyleMask_? windowStyleMask; @@ -278,14 +278,14 @@ class InAppBrowserSettings_ /// ///**NOTE for MacOS**: available on MacOS 11.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowTitlebarSeparatorStyle_? windowTitlebarSeparatorStyle; ///Sets the origin and size of the window’s frame rectangle according to a given frame rectangle, ///thereby setting its position and size onscreen. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS InAppWebViewRect_? windowFrame; diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.g.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.g.dart index 9d18bc54..4c2fe0f6 100644 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.g.dart @@ -11,32 +11,32 @@ class InAppBrowserSettings implements BrowserOptions, AndroidOptions, IosOptions { ///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? allowGoBackWithBackButton; ///Set the custom text for the close button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS String? closeButtonCaption; ///Set the custom color for the close button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? closeButtonColor; ///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? closeOnCannotGoBack; ///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -44,20 +44,20 @@ class InAppBrowserSettings ///Set to `true` to hide the close button. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? hideCloseButton; ///Set to `true` to hide the default menu items. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS bool? hideDefaultMenuItems; ///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -65,19 +65,19 @@ class InAppBrowserSettings ///Set to `true` if you want the title should be displayed. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? hideTitleBar; ///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? hideToolbarBottom; ///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -85,7 +85,7 @@ class InAppBrowserSettings ///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -93,43 +93,43 @@ class InAppBrowserSettings ///Set the custom color for the menu button. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? menuButtonColor; ///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalPresentationStyle? presentationStyle; ///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? shouldCloseOnBackButtonPressed; ///Set the custom background color of the toolbar at the bottom. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? toolbarBottomBackgroundColor; ///Set the tint color to apply to the bar button items. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? toolbarBottomTintColor; ///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? toolbarBottomTranslucent; ///Set the custom background color of the toolbar at the top. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -137,52 +137,52 @@ class InAppBrowserSettings ///Set the tint color to apply to the navigation bar background. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? toolbarTopBarTintColor; ///Set the action bar's title. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- MacOS String? toolbarTopFixedTitle; ///Set the tint color to apply to the navigation items and bar button items. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS Color? toolbarTopTintColor; ///Set to `true` to set the toolbar at the top translucent. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS bool? toolbarTopTranslucent; ///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ModalTransitionStyle? transitionStyle; ///The window’s alpha value. ///The default value is `1.0`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS double? windowAlphaValue; ///Sets the origin and size of the window’s frame rectangle according to a given frame rectangle, ///thereby setting its position and size onscreen. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS InAppWebViewRect? windowFrame; ///Flags that describe the window’s current style, such as if it’s resizable or in full-screen mode. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowStyleMask? windowStyleMask; @@ -190,14 +190,14 @@ class InAppBrowserSettings /// ///**NOTE for MacOS**: available on MacOS 11.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowTitlebarSeparatorStyle? windowTitlebarSeparatorStyle; ///How the browser window should be added to the main window. ///The default value is [WindowType.CHILD]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- MacOS WindowType? windowType; InAppBrowserSettings( 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 52cc0a49..ae8f8860 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 @@ -54,13 +54,17 @@ class PlatformInAppBrowserCreationParams { final int? windowId; } -///This class uses the native WebView of the platform. +///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser} +///This class represents a native WebView displayed on top of the Flutter App, +///so it's not integrated into the Flutter widget tree. +///It uses the native WebView of the platform. ///The [webViewController] field can be used to access the [PlatformInAppWebViewController] API. /// -///**Supported Platforms/Implementations**: +///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS +///@{endtemplate} abstract class PlatformInAppBrowser extends PlatformInterface implements Disposable { ///Debug settings. @@ -72,7 +76,9 @@ abstract class PlatformInAppBrowser extends PlatformInterface ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.id} ///View ID used internally. ///@{endtemplate} - String get id; + 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. @@ -153,6 +159,7 @@ abstract class PlatformInAppBrowser extends PlatformInterface /// The parameters used to initialize the [PlatformInAppBrowser]. final PlatformInAppBrowserCreationParams params; + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.openUrlRequest} ///Opens the [PlatformInAppBrowser] instance with an [urlRequest]. /// ///[urlRequest]: The [urlRequest] to load. @@ -161,10 +168,11 @@ abstract class PlatformInAppBrowser extends PlatformInterface /// ///[settings]: Settings for the [PlatformInAppBrowser]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future openUrlRequest( {required URLRequest urlRequest, // ignore: deprecated_member_use_from_same_package @@ -174,6 +182,7 @@ abstract class PlatformInAppBrowser extends PlatformInterface 'openUrlRequest is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.openFile} ///Opens the [PlatformInAppBrowser] instance with the given [assetFilePath] file. /// ///[options]: Options for the [PlatformInAppBrowser]. @@ -212,10 +221,11 @@ abstract class PlatformInAppBrowser extends PlatformInterface /// ///[settings]: Settings for the [PlatformInAppBrowser]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future openFile( {required String assetFilePath, // ignore: deprecated_member_use_from_same_package @@ -225,6 +235,7 @@ abstract class PlatformInAppBrowser extends PlatformInterface 'openFile is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.openData} ///Opens the [PlatformInAppBrowser] instance with [data] as a content, using [baseUrl] as the base URL for it. /// ///The [mimeType] parameter specifies the format of the data. The default value is `"text/html"`. @@ -237,10 +248,11 @@ abstract class PlatformInAppBrowser extends PlatformInterface /// ///[settings]: Settings for the [PlatformInAppBrowser]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future openData( {required String data, String mimeType = "text/html", @@ -255,178 +267,212 @@ abstract class PlatformInAppBrowser extends PlatformInterface 'openData is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.openWithSystemBrowser} ///This is a static method that opens an [url] in the system browser. You wont be able to use the [PlatformInAppBrowser] methods here! /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future openWithSystemBrowser({required WebUri url}) { throw UnimplementedError( 'openWithSystemBrowser is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.addMenuItem} ///Adds a [InAppBrowserMenuItem] to the menu. ///If the browser is already open, ///it will take effect the next time it is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS 14.0+ + ///{@endtemplate} void addMenuItem(InAppBrowserMenuItem menuItem) { throw UnimplementedError( 'addMenuItem is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.addMenuItems} ///Adds a list of [InAppBrowserMenuItem] to the menu. ///If the browser is already open, ///it will take effect the next time it is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS 14.0+ + ///{@endtemplate} void addMenuItems(List menuItems) { throw UnimplementedError( 'addMenuItems is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.removeMenuItem} ///Removes the [menuItem] from the list. ///Returns `true` if it was in the list, `false` otherwise. ///If the browser is already open, ///it will take effect the next time it is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS 14.0+ + ///{@endtemplate} bool removeMenuItem(InAppBrowserMenuItem menuItem) { throw UnimplementedError( 'removeMenuItem is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.removeMenuItems} ///Removes a list of [menuItems] from the list. ///If the browser is already open, ///it will take effect the next time it is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS 14.0+ + ///{@endtemplate} void removeMenuItems(List menuItems) { throw UnimplementedError( 'removeMenuItems is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.removeAllMenuItem} ///Removes all the menu items from the list. ///If the browser is already open, ///it will take effect the next time it is opened. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android ///- iOS 14.0+ + ///{@endtemplate} void removeAllMenuItem() { throw UnimplementedError( 'removeAllMenuItem is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.hasMenuItem} ///Returns `true` if the [menuItem] has been already added, otherwise `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS 14.0+ + ///{@endtemplate} bool hasMenuItem(InAppBrowserMenuItem menuItem) { throw UnimplementedError( 'hasMenuItem is not implemented on the current platform'); } - ///Displays an [PlatformInAppBrowser] window that was opened hidden. Calling this has no effect if the [PlatformInAppBrowser] was already visible. + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.show} + ///Displays a [PlatformInAppBrowser] window that was opened hidden. Calling this has no effect if the [PlatformInAppBrowser] was already visible. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future show() { throw UnimplementedError('show is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.hide} ///Hides the [PlatformInAppBrowser] window. Calling this has no effect if the [PlatformInAppBrowser] was already hidden. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future hide() { throw UnimplementedError('hide is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.close} ///Closes the [PlatformInAppBrowser] window. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future close() { throw UnimplementedError( 'close is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.isHidden} ///Check if the Web View of the [PlatformInAppBrowser] instance is hidden. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future isHidden() { throw UnimplementedError( 'isHidden is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.setOptions} ///Use [setSettings] instead. + ///{@endtemplate} @Deprecated('Use setSettings instead') Future setOptions({required InAppBrowserClassOptions options}) { throw UnimplementedError( 'setOptions is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.getOptions} ///Use [getSettings] instead. + ///{@endtemplate} @Deprecated('Use getSettings instead') Future getOptions() { throw UnimplementedError( 'getOptions is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.setSettings} ///Sets the [PlatformInAppBrowser] settings with the new [settings] and evaluates them. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future setSettings({required InAppBrowserClassSettings settings}) { throw UnimplementedError( 'setSettings is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.getSettings} ///Gets the current [PlatformInAppBrowser] settings. Returns `null` if it wasn't able to get them. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} Future getSettings() { throw UnimplementedError( 'getSettings is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.isOpened} ///Returns `true` if the [PlatformInAppBrowser] instance is opened, otherwise `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS + ///{@endtemplate} bool isOpened() { throw UnimplementedError( 'isOpened is not implemented on the current platform'); } + ///{@template flutter_inappwebview_platform_interface.PlatformInAppBrowser.dispose} ///Disposes the channel and controllers. + ///{@endtemplate} @override void dispose() { throw UnimplementedError( @@ -437,7 +483,7 @@ abstract class PlatformInAppBrowser extends PlatformInterface abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] is created. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -445,7 +491,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] window is closed. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -453,7 +499,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] starts to load an [url]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview)) @@ -461,7 +507,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] finishes loading an [url]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview)) @@ -473,7 +519,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] encounters an [error] loading a [request]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) @@ -491,7 +537,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: available on Android 23+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) @@ -500,7 +546,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the current [progress] (range 0-100) of loading a page is changed. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int))) ///- iOS ///- MacOS @@ -508,7 +554,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] webview receives a [ConsoleMessage]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage))) ///- iOS ///- MacOS @@ -526,7 +572,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] setting to `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview)) @@ -539,7 +585,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] setting to `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -553,7 +599,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for MacOS**: this method is implemented with using JavaScript. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int))) ///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll)) ///- MacOS @@ -570,7 +616,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] setting to `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener))) ///- iOS ///- MacOS @@ -585,7 +631,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the [PlatformInAppBrowser] webview finds the `custom-scheme` while loading a resource. ///Here you can handle the url [request] and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler)) ///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler)) @@ -622,7 +668,7 @@ abstract class PlatformInAppBrowserEvents { ///Also, note that calling [PlatformInAppWebViewController.setSettings] method using the controller of the new created WebView, ///it will update also the WebView options of the caller WebView. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message))) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview)) @@ -633,7 +679,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the host application should close the given WebView and remove it from the view system if necessary. ///At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView))) ///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) ///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) @@ -642,7 +688,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the JavaScript `window` object of the WebView has received focus. ///This is the result of the `focus` javascript event applied to the `window` object. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -651,7 +697,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the JavaScript `window` object of the WebView has lost focus. ///This is the result of the `blur` javascript event applied to the `window` object. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -662,7 +708,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[jsAlertRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview)) @@ -675,7 +721,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[jsConfirmRequest] contains the message to be displayed in the confirm dialog and the of the page requesting the dialog. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview)) @@ -688,7 +734,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[jsPromptRequest] contains the message to be displayed in the prompt dialog, the default value displayed in the prompt dialog, and the of the page requesting the dialog. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult))) ///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview)) @@ -700,7 +746,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [URLAuthenticationChallenge]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) @@ -714,7 +760,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) @@ -730,7 +776,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) @@ -755,7 +801,7 @@ abstract class PlatformInAppBrowserEvents { ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -774,7 +820,7 @@ abstract class PlatformInAppBrowserEvents { ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -793,7 +839,7 @@ abstract class PlatformInAppBrowserEvents { ///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -812,7 +858,7 @@ abstract class PlatformInAppBrowserEvents { ///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). ///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the fetch requests will be intercept for sure. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -830,7 +876,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[isReload] indicates if this url is being reloaded. Available only on Android. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean))) ///- iOS ///- MacOS @@ -848,7 +894,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[printJobController] represents the controller of the print job created. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ///- iOS ///- MacOS @@ -861,14 +907,14 @@ abstract class PlatformInAppBrowserEvents { /// ///[hitTestResult] represents the hit result for hitting an HTML elements. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener))) ///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer)) void onLongPressHitTestResult(InAppWebViewHitTestResult hitTestResult) {} ///Event fired when the current page has entered full screen mode. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback))) ///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification)) ///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification)) @@ -876,7 +922,7 @@ abstract class PlatformInAppBrowserEvents { ///Event fired when the current page has exited full screen mode. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView())) ///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification)) ///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification)) @@ -889,7 +935,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[url] represents the URL corresponding to the page navigation that triggered this callback. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String))) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) @@ -899,7 +945,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[title] represents the string containing the new title of the document. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String))) ///- iOS ///- MacOS @@ -915,7 +961,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[clampedY] is `true` if [y] was clamped to an over-scroll boundary. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean))) ///- iOS void onOverScrolled(int x, int y, bool clampedX, bool clampedY) {} @@ -926,7 +972,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[newScale] The new zoom scale factor.ì /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onScaleChanged](https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float))) ///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidZoom](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619409-scrollviewdidzoom)) void onZoomScaleChanged(double oldScale, double newScale) {} @@ -947,7 +993,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: available only on Android 27+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse))) Future? onSafeBrowsingHit( WebUri url, SafeBrowsingThreat? threatType) { @@ -972,7 +1018,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for MacOS**: available only on iOS 12.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT]. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest))) ///- iOS ///- MacOS @@ -994,7 +1040,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[origin] represents the origin of the web content attempting to use the Geolocation API. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback))) Future? onGeolocationPermissionsShowPrompt(String origin) { @@ -1008,7 +1054,7 @@ abstract class PlatformInAppBrowserEvents { ///Notify the host application that a request for Geolocation permissions, made with a previous call to [onGeolocationPermissionsShowPrompt] has been canceled. ///Any related UI should therefore be hidden. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt())) void onGeolocationPermissionsHidePrompt() {} @@ -1033,7 +1079,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptRequest] option to `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest))) Future? shouldInterceptRequest( WebResourceRequest request) { @@ -1064,7 +1110,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: available only on Android 29+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) Future? onRenderProcessUnresponsive( WebUri? url) { @@ -1088,7 +1134,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: available only on Android 29+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) Future? onRenderProcessResponsive(WebUri? url) { return null; @@ -1106,7 +1152,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: available only on Android 26+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail))) void onRenderProcessGone(RenderProcessGoneDetail detail) {} @@ -1118,7 +1164,7 @@ abstract class PlatformInAppBrowserEvents { ///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message))) Future? onFormResubmission(WebUri? url) { return null; @@ -1136,7 +1182,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[icon] represents the favicon for the current page. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap))) void onReceivedIcon(Uint8List icon) {} @@ -1150,7 +1196,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[precomposed] is `true` if the url is for a precomposed touch icon. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean))) void onReceivedTouchIconUrl(WebUri url, bool precomposed) {} @@ -1171,7 +1217,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[jsBeforeUnloadRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) Future? onJsBeforeUnload( JsBeforeUnloadRequest jsBeforeUnloadRequest) { @@ -1186,7 +1232,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[loginRequest] contains the realm, account and args of the login request. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String))) void onReceivedLoginRequest(LoginRequest loginRequest) {} @@ -1198,14 +1244,14 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for Android**: available only on Android 21+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onPermissionRequestCanceled](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequestCanceled(android.webkit.PermissionRequest))) void onPermissionRequestCanceled(PermissionRequest permissionRequest) {} ///Request display and focus for this WebView. ///This may happen due to another WebView opening a link in this WebView and requesting that this WebView be displayed. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onRequestFocus](https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView))) void onRequestFocus() {} @@ -1215,7 +1261,7 @@ abstract class PlatformInAppBrowserEvents { ///Invoked when the web view's web content process is terminated. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) ///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) void onWebContentProcessDidTerminate() {} @@ -1226,7 +1272,7 @@ abstract class PlatformInAppBrowserEvents { ///Called when a web view receives a server redirect. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) void onDidReceiveServerRedirectForProvisionalNavigation() {} @@ -1244,7 +1290,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] setting to `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) Future? onNavigationResponse( @@ -1267,7 +1313,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for MacOS**: available only on MacOS 11.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview)) Future? shouldAllowDeprecatedTLS( @@ -1281,7 +1327,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for MacOS**: available only on MacOS 12.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ///- MacOS void onCameraCaptureStateChanged( @@ -1296,7 +1342,7 @@ abstract class PlatformInAppBrowserEvents { /// ///**NOTE for MacOS**: available only on MacOS 12.0+. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ///- MacOS void onMicrophoneCaptureStateChanged( @@ -1310,7 +1356,7 @@ abstract class PlatformInAppBrowserEvents { /// ///[newContentSize] represents the new content size value. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS void onContentSizeChanged(Size oldContentSize, Size newContentSize) {} } diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_localhost_server.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_localhost_server.dart index 26e2814a..ffdb9abd 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_localhost_server.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_localhost_server.dart @@ -30,14 +30,7 @@ class DefaultInAppLocalhostServerCreationParams } } -///This class allows you to create a simple server on `http://localhost:[port]/` -///in order to be able to load your assets file on a local server. -///The default `port` value is `8080`. -/// -///**Supported Platforms/Implementations**: -///- Android native WebView -///- iOS -///- MacOS +///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer} class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer { bool _started = false; HttpServer? _server; @@ -61,30 +54,19 @@ class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer { this._shared = shared; } - ///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port} + @override int get port => _port; - ///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex} + @override String get directoryIndex => _directoryIndex; - ///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot} + @override String get documentRoot => _documentRoot; - ///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared} + @override bool get shared => _shared; - ///Starts the server on `http://localhost:[port]/`. - /// - ///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file - ///(See [ATS Configuration Basics](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35)): - ///```xml - ///NSAppTransportSecurity - /// - /// NSAllowsLocalNetworking - /// - /// - ///``` - ///The `NSAllowsLocalNetworking` key is available since **iOS 10**. + @override Future start() async { if (this._started) { throw Exception('Server already started on http://localhost:$_port'); @@ -142,7 +124,7 @@ class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer { return completer.future; } - ///Closes the server. + @override Future close() async { if (this._server == null) { return; @@ -153,7 +135,7 @@ class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer { this._server = null; } - ///Indicates if the server is running or not. + @override bool isRunning() { return this._server != null; } diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/android/in_app_webview_options.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/android/in_app_webview_options.dart index 044076ba..dc956e13 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/android/in_app_webview_options.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/android/in_app_webview_options.dart @@ -158,10 +158,10 @@ class AndroidInAppWebViewOptions bool hardwareAcceleration; ///Sets whether the WebView supports multiple windows. - ///If set to `true`, [WebView.onCreateWindow] event must be implemented by the host application. The default value is `false`. + ///If set to `true`, [PlatformWebViewCreationParams.onCreateWindow] event must be implemented by the host application. The default value is `false`. bool supportMultipleWindows; - ///Regular expression used by [WebView.shouldOverrideUrlLoading] event to cancel navigation requests for frames that are not the main frame. + ///Regular expression used by [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event to cancel navigation requests for frames that are not the main frame. ///If the url request of a subframe matches the regular expression, then the request of that subframe is canceled. String? regexToCancelSubFramesLoading; @@ -172,10 +172,10 @@ class AndroidInAppWebViewOptions ///as it can cause framerate drops on animations in Android 9 and lower (see [Hybrid-Composition#performance](https://github.com/flutter/flutter/wiki/Hybrid-Composition#performance)). bool useHybridComposition; - ///Set to `true` to be able to listen at the [WebView.androidShouldInterceptRequest] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.androidShouldInterceptRequest] event. The default value is `false`. bool useShouldInterceptRequest; - ///Set to `true` to be able to listen at the [WebView.androidOnRenderProcessGone] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.androidOnRenderProcessGone] event. The default value is `false`. bool useOnRenderProcessGone; ///Sets the WebView's over-scroll mode. diff --git a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/apple/in_app_webview_options.dart b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/apple/in_app_webview_options.dart index da42cc02..e656a4ba 100755 --- a/flutter_inappwebview_platform_interface/lib/src/in_app_webview/apple/in_app_webview_options.dart +++ b/flutter_inappwebview_platform_interface/lib/src/in_app_webview/apple/in_app_webview_options.dart @@ -152,7 +152,7 @@ class IOSInAppWebViewOptions ///**NOTE**: available on iOS 14.0+. bool limitsNavigationsToAppBoundDomains; - ///Set to `true` to be able to listen to the [WebView.iosOnNavigationResponse] event. The default value is `false`. + ///Set to `true` to be able to listen to the [PlatformWebViewCreationParams.iosOnNavigationResponse] event. The default value is `false`. bool useOnNavigationResponse; ///Set to `true` to enable Apple Pay API for the `WebView` at its first page load or on the next page load (using [PlatformInAppWebViewController.setOptions]). The default value is `false`. @@ -187,7 +187,7 @@ class IOSInAppWebViewOptions ///- [PlatformInAppWebViewController.addWebMessageListener] /// ///Options affected: - ///- [WebView.initialUserScripts] + ///- [PlatformWebViewCreationParams.initialUserScripts] ///- [InAppWebViewOptions.supportZoom] ///- [InAppWebViewOptions.useOnLoadResource] ///- [InAppWebViewOptions.useShouldInterceptAjaxRequest] @@ -195,26 +195,26 @@ class IOSInAppWebViewOptions ///- [IOSInAppWebViewOptions.enableViewportScale] /// ///Events affected: - ///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty + ///- the `hitTestResult` argument of [PlatformWebViewCreationParams.onLongPressHitTestResult] will be empty ///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty - ///- [WebView.onLoadResource] - ///- [WebView.shouldInterceptAjaxRequest] - ///- [WebView.onAjaxReadyStateChange] - ///- [WebView.onAjaxProgress] - ///- [WebView.shouldInterceptFetchRequest] - ///- [WebView.onConsoleMessage] - ///- [WebView.onPrint] - ///- [WebView.onWindowFocus] - ///- [WebView.onWindowBlur] - ///- [WebView.onFindResultReceived] + ///- [PlatformWebViewCreationParams.onLoadResource] + ///- [PlatformWebViewCreationParams.shouldInterceptAjaxRequest] + ///- [PlatformWebViewCreationParams.onAjaxReadyStateChange] + ///- [PlatformWebViewCreationParams.onAjaxProgress] + ///- [PlatformWebViewCreationParams.shouldInterceptFetchRequest] + ///- [PlatformWebViewCreationParams.onConsoleMessage] + ///- [PlatformWebViewCreationParams.onPrint] + ///- [PlatformWebViewCreationParams.onWindowFocus] + ///- [PlatformWebViewCreationParams.onWindowBlur] + ///- [PlatformWebViewCreationParams.onFindResultReceived] /// ///**NOTE**: available on iOS 13.0+. bool applePayAPIEnabled; - ///Used in combination with [WebView.initialUrlRequest] or [WebView.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. + ///Used in combination with [PlatformWebViewCreationParams.initialUrlRequest] or [PlatformWebViewCreationParams.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. ///This URL must be a file-based URL (using the `file://` scheme). - ///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or - ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [WebView.initialData] parameter to prevent WebView from reading any other content. + ///Specify the same value as the [URLRequest.url] if you are using it with the [PlatformWebViewCreationParams.initialUrlRequest] parameter or + ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [PlatformWebViewCreationParams.initialData] parameter to prevent WebView from reading any other content. ///Specify a directory to give WebView permission to read additional files in the specified directory. Uri? allowingReadAccessTo; 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 fdec8fbe..7599b599 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 @@ -32,6 +32,7 @@ import '../platform_webview_feature.dart'; import '../in_app_webview/platform_inappwebview_controller.dart'; import '../context_menu/context_menu.dart'; import '../in_app_browser/platform_in_app_browser.dart'; +import 'platform_webview.dart'; part 'in_app_webview_settings.g.dart'; @@ -51,27 +52,27 @@ List _deserializeContentBlockers( ///This class represents all the WebView settings available. @ExchangeableObject(copyMethod: true) class InAppWebViewSettings_ { - ///Set to `true` to be able to listen at the [WebView.shouldOverrideUrlLoading] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event. /// - ///If the [WebView.shouldOverrideUrlLoading] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms( platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()]) bool? useShouldOverrideUrlLoading; - ///Set to `true` to be able to listen at the [WebView.onLoadResource] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onLoadResource] event. /// - ///If the [WebView.onLoadResource] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.onLoadResource] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms( platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()]) bool? useOnLoadResource; - ///Set to `true` to be able to listen at the [WebView.onDownloadStartRequest] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onDownloadStartRequest] event. /// - ///If the [WebView.onDownloadStartRequest] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.onDownloadStartRequest] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms( @@ -219,7 +220,7 @@ class InAppWebViewSettings_ { ]) bool? horizontalScrollBarEnabled; - ///List of custom schemes that the WebView must handle. Use the [WebView.onLoadResourceWithCustomScheme] event to intercept resource requests with custom scheme. + ///List of custom schemes that the WebView must handle. Use the [PlatformWebViewCreationParams.onLoadResourceWithCustomScheme] event to intercept resource requests with custom scheme. @SupportedPlatforms(platforms: [ AndroidPlatform(), IOSPlatform(available: "11.0"), @@ -252,18 +253,18 @@ class InAppWebViewSettings_ { ]) UserPreferredContentMode_? preferredContentMode; - ///Set to `true` to be able to listen at the [WebView.shouldInterceptAjaxRequest] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldInterceptAjaxRequest] event. /// - ///If the [WebView.shouldInterceptAjaxRequest] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.shouldInterceptAjaxRequest] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms( platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()]) bool? useShouldInterceptAjaxRequest; - ///Set to `true` to be able to listen at the [WebView.shouldInterceptFetchRequest] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldInterceptFetchRequest] event. /// - ///If the [WebView.shouldInterceptFetchRequest] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.shouldInterceptFetchRequest] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms( @@ -605,7 +606,7 @@ because there isn't any way to make the website data store non-persistent for th note: """Please note that in order for the Geolocation API to be usable by a page in the WebView, the following requirements must be met: - an application must have permission to access the device location, see [Manifest.permission.ACCESS_COARSE_LOCATION](https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION), [Manifest.permission.ACCESS_FINE_LOCATION](https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION); -- an application must provide an implementation of the [WebView.onGeolocationPermissionsShowPrompt] callback to receive notifications that a page is requesting access to location via the JavaScript Geolocation API.""") +- an application must provide an implementation of the [PlatformWebViewCreationParams.onGeolocationPermissionsShowPrompt] callback to receive notifications that a page is requesting access to location via the JavaScript Geolocation API.""") ]) bool? geolocationEnabled; @@ -745,7 +746,7 @@ because there isn't any way to make the website data store non-persistent for th bool? hardwareAcceleration; ///Sets whether the WebView supports multiple windows. - ///If set to `true`, [WebView.onCreateWindow] event must be implemented by the host application. The default value is `false`. + ///If set to `true`, [PlatformWebViewCreationParams.onCreateWindow] event must be implemented by the host application. The default value is `false`. @SupportedPlatforms(platforms: [ AndroidPlatform( apiName: "WebSettings.setSupportMultipleWindows", @@ -754,7 +755,7 @@ because there isn't any way to make the website data store non-persistent for th ]) bool? supportMultipleWindows; - ///Regular expression used by [WebView.shouldOverrideUrlLoading] event to cancel navigation requests for frames that are not the main frame. + ///Regular expression used by [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event to cancel navigation requests for frames that are not the main frame. ///If the url request of a subframe matches the regular expression, then the request of that subframe is canceled. @SupportedPlatforms(platforms: [AndroidPlatform()]) String? regexToCancelSubFramesLoading; @@ -769,17 +770,17 @@ as it can cause framerate drops on animations in Android 9 and lower (see [Hybri ]) bool? useHybridComposition; - ///Set to `true` to be able to listen at the [WebView.shouldInterceptRequest] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldInterceptRequest] event. /// - ///If the [WebView.shouldInterceptRequest] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.shouldInterceptRequest] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms(platforms: [AndroidPlatform()]) bool? useShouldInterceptRequest; - ///Set to `true` to be able to listen at the [WebView.onRenderProcessGone] event. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onRenderProcessGone] event. /// - ///If the [WebView.onRenderProcessGone] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.onRenderProcessGone] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms(platforms: [AndroidPlatform()]) @@ -1288,9 +1289,9 @@ as it can cause framerate drops on animations in Android 9 and lower (see [Hybri ]) bool? limitsNavigationsToAppBoundDomains; - ///Set to `true` to be able to listen to the [WebView.onNavigationResponse] event. + ///Set to `true` to be able to listen to the [PlatformWebViewCreationParams.onNavigationResponse] event. /// - ///If the [WebView.onNavigationResponse] event is implemented and this value is `null`, + ///If the [PlatformWebViewCreationParams.onNavigationResponse] event is implemented and this value is `null`, ///it will be automatically inferred as `true`, otherwise, the default value is `false`. ///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually. @SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()]) @@ -1338,7 +1339,7 @@ as it can cause framerate drops on animations in Android 9 and lower (see [Hybri ///- [PlatformInAppWebViewController.canScrollHorizontally] /// ///Settings affected: - ///- [WebView.initialUserScripts] + ///- [PlatformWebViewCreationParams.initialUserScripts] ///- [InAppWebViewSettings.supportZoom] ///- [InAppWebViewSettings.useOnLoadResource] ///- [InAppWebViewSettings.useShouldInterceptAjaxRequest] @@ -1346,32 +1347,32 @@ as it can cause framerate drops on animations in Android 9 and lower (see [Hybri ///- [InAppWebViewSettings.enableViewportScale] /// ///Events affected: - ///- the `hitTestResult` argument of [WebView.onLongPressHitTestResult] will be empty + ///- the `hitTestResult` argument of [PlatformWebViewCreationParams.onLongPressHitTestResult] will be empty ///- the `hitTestResult` argument of [ContextMenu.onCreateContextMenu] will be empty - ///- [WebView.onLoadResource] - ///- [WebView.shouldInterceptAjaxRequest] - ///- [WebView.onAjaxReadyStateChange] - ///- [WebView.onAjaxProgress] - ///- [WebView.shouldInterceptFetchRequest] - ///- [WebView.onConsoleMessage] - ///- [WebView.onPrintRequest] - ///- [WebView.onWindowFocus] - ///- [WebView.onWindowBlur] - ///- [WebView.onFindResultReceived] + ///- [PlatformWebViewCreationParams.onLoadResource] + ///- [PlatformWebViewCreationParams.shouldInterceptAjaxRequest] + ///- [PlatformWebViewCreationParams.onAjaxReadyStateChange] + ///- [PlatformWebViewCreationParams.onAjaxProgress] + ///- [PlatformWebViewCreationParams.shouldInterceptFetchRequest] + ///- [PlatformWebViewCreationParams.onConsoleMessage] + ///- [PlatformWebViewCreationParams.onPrintRequest] + ///- [PlatformWebViewCreationParams.onWindowFocus] + ///- [PlatformWebViewCreationParams.onWindowBlur] + ///- [PlatformWebViewCreationParams.onFindResultReceived] ///- [FindInteractionController.onFindResultReceived] /// ///Also, on MacOS: - ///- [WebView.onScrollChanged] + ///- [PlatformWebViewCreationParams.onScrollChanged] @SupportedPlatforms(platforms: [ IOSPlatform(available: "13.0"), MacOSPlatform(available: "10.15") ]) bool? applePayAPIEnabled; - ///Used in combination with [WebView.initialUrlRequest] or [WebView.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. + ///Used in combination with [PlatformWebViewCreationParams.initialUrlRequest] or [PlatformWebViewCreationParams.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. ///This URL must be a file-based URL (using the `file://` scheme). - ///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or - ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [WebView.initialData] parameter to prevent WebView from reading any other content. + ///Specify the same value as the [URLRequest.url] if you are using it with the [PlatformWebViewCreationParams.initialUrlRequest] parameter or + ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [PlatformWebViewCreationParams.initialData] parameter to prevent WebView from reading any other content. ///Specify a directory to give WebView permission to read additional files in the specified directory. @SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()]) WebUri? allowingReadAccessTo; @@ -1854,13 +1855,13 @@ class WebViewOptions { @Deprecated('Use InAppWebViewSettings instead') class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions, IosOptions { - ///Set to `true` to be able to listen at the [WebView.shouldOverrideUrlLoading] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event. The default value is `false`. bool useShouldOverrideUrlLoading; - ///Set to `true` to be able to listen at the [WebView.onLoadResource] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onLoadResource] event. The default value is `false`. bool useOnLoadResource; - ///Set to `true` to be able to listen at the [WebView.onDownloadStart] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onDownloadStart] event. The default value is `false`. bool useOnDownloadStart; ///Set to `true` to have all the browser's cache cleared before the new WebView is opened. The default value is `false`. @@ -1896,7 +1897,7 @@ class InAppWebViewOptions ///Define whether the horizontal scrollbar should be drawn or not. The default value is `true`. bool horizontalScrollBarEnabled; - ///List of custom schemes that the WebView must handle. Use the [WebView.onLoadResourceCustomScheme] event to intercept resource requests with custom scheme. + ///List of custom schemes that the WebView must handle. Use the [PlatformWebViewCreationParams.onLoadResourceCustomScheme] event to intercept resource requests with custom scheme. /// ///**NOTE**: available on iOS 11.0+. List resourceCustomSchemes; @@ -1911,10 +1912,10 @@ class InAppWebViewOptions ///**NOTE**: available on iOS 13.0+. UserPreferredContentMode? preferredContentMode; - ///Set to `true` to be able to listen at the [WebView.shouldInterceptAjaxRequest] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldInterceptAjaxRequest] event. The default value is `false`. bool useShouldInterceptAjaxRequest; - ///Set to `true` to be able to listen at the [WebView.shouldInterceptFetchRequest] event. The default value is `false`. + ///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.shouldInterceptFetchRequest] event. The default value is `false`. bool useShouldInterceptFetchRequest; ///Set to `true` to open a browser window with incognito mode. The default value is `false`. 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 f211b41d..d436b37c 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 @@ -11,7 +11,7 @@ class InAppWebViewSettings { ///A Boolean value indicating whether the WebView ignores an accessibility request to invert its colors. ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS 11.0+ ([Official API - UIView.accessibilityIgnoresInvertColors](https://developer.apple.com/documentation/uikit/uiview/2865843-accessibilityignoresinvertcolors)) bool? accessibilityIgnoresInvertColors; @@ -29,7 +29,7 @@ class InAppWebViewSettings { /// ///**NOTE for Android native WebView**: available on Android only if [WebViewFeature.ALGORITHMIC_DARKENING] feature is supported. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView 29+ ([Official API - WebSettingsCompat.setAlgorithmicDarkeningAllowed](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean))) bool? algorithmicDarkeningAllowed; @@ -41,20 +41,20 @@ class InAppWebViewSettings { ///**IMPORTANT NOTE**: if you use this setting, your app could be rejected by the Google Play Store. ///For example, if you allow background playing of YouTube videos, which is a violation of the YouTube API Terms of Service. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView bool? allowBackgroundAudioPlaying; ///Enables or disables content URL access within WebView. Content URL access allows WebView to load content from a content provider installed in the system. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebSettings.setAllowContentAccess](https://developer.android.com/reference/android/webkit/WebSettings?hl=en#setAllowContentAccess(boolean))) bool? allowContentAccess; ///Enables or disables file access within WebView. Note that this enables or disables file system access only. ///Assets and resources are still accessible using `file:///android_asset` and `file:///android_res`. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebSettings.setAllowFileAccess](https://developer.android.com/reference/android/webkit/WebSettings?hl=en#setAllowFileAccess(boolean))) bool? allowFileAccess; @@ -68,7 +68,7 @@ class InAppWebViewSettings { /// ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebSettings.setAllowFileAccessFromFileURLs](https://developer.android.com/reference/android/webkit/WebSettings?hl=en#setAllowFileAccessFromFileURLs(boolean))) ///- iOS ///- MacOS @@ -84,33 +84,33 @@ class InAppWebViewSettings { /// ///The default value is `false`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebSettings.setAllowUniversalAccessFromFileURLs](https://developer.android.com/reference/android/webkit/WebSettings?hl=en#setAllowUniversalAccessFromFileURLs(boolean))) ///- iOS ///- MacOS bool? allowUniversalAccessFromFileURLs; - ///Used in combination with [WebView.initialUrlRequest] or [WebView.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. + ///Used in combination with [PlatformWebViewCreationParams.initialUrlRequest] or [PlatformWebViewCreationParams.initialData] (using the `file://` scheme), it represents the URL from which to read the web content. ///This URL must be a file-based URL (using the `file://` scheme). - ///Specify the same value as the [URLRequest.url] if you are using it with the [WebView.initialUrlRequest] parameter or - ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [WebView.initialData] parameter to prevent WebView from reading any other content. + ///Specify the same value as the [URLRequest.url] if you are using it with the [PlatformWebViewCreationParams.initialUrlRequest] parameter or + ///the [InAppWebViewInitialData.baseUrl] if you are using it with the [PlatformWebViewCreationParams.initialData] parameter to prevent WebView from reading any other content. ///Specify a directory to give WebView permission to read additional files in the specified directory. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ///- MacOS WebUri? allowingReadAccessTo; ///Set to `true` to allow AirPlay. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebViewConfiguration.allowsAirPlayForMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1395673-allowsairplayformediaplayback)) ///- MacOS ([Official API - WKWebViewConfiguration.allowsAirPlayForMediaPlayback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1395673-allowsairplayformediaplayback)) bool? allowsAirPlayForMediaPlayback; ///Set to `true` to allow the horizontal swipe gestures trigger back-forward list navigations. The default value is `true`. /// - ///**Supported Platforms/Implementations**: + ///**Officially Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.allowsBackForwardNavigationGestures](https://developer.apple.com/documentation/webkit/wkwebview/1414995-allowsbackforwardnavigationgestu)) ///- MacOS ([Official API - WKWebView.allowsBackForwardNavigationGestures](https://developer.apple.com/documentation/webkit/wkwebview/1414995-allowsbackforwardnavigationgestu)) bool? allowsBackForwardNavigationGestures; @@ -118,20 +118,20 @@ class InAppWebViewSettings { ///Set to `true` to allow HTML5 media playback to appear inline within the screen layout, using browser-supplied controls rather than native controls. ///For this to work, add the `webkit-playsinline` attribute to any `