diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b1428417..284ae037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,13 +15,8 @@ - - - - - - - + + @@ -45,8 +40,8 @@ - - + + @@ -55,34 +50,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -90,28 +61,10 @@ - - - - - - - - - - - - - - - - - - - + @@ -123,7 +76,7 @@ - + @@ -141,11 +94,6 @@ - onAjaxEvent - shouldInterceptAjaxRequest - onAjaxProgress - onAjaxReady - NAVIGATION onNavigationStateChange shouldInterceptFetchRequest scheme @@ -165,12 +113,17 @@ XMLHttpRequest nDownloadStart ServerTrustAuthResponse - onDow - InAppWebViewUserPreferredContentMode verticalScrollBarEnabled mixedContentMode eWideViewPort initialScale + mediaPlaybackRequiresUserGesture + onDow + toolbarTopFixedTitle + resourceCustomSchemes + JsAlertResponse + InAppWebViewUserPreferredContentMode + JsConfirmResponse activity.getPreferences(0) @@ -240,13 +193,13 @@ @@ -492,7 +445,7 @@ - + @@ -511,7 +464,7 @@ - + @@ -702,16 +655,6 @@ - - - - - - - - - - @@ -744,49 +687,59 @@ - + - + - - - - - - - - - - - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + @@ -795,20 +748,20 @@ - - + + - + - - + + - + diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java index 52e41ae7..3d49a6fc 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java @@ -117,10 +117,10 @@ public class InAppBrowserActivity extends AppCompatActivity { if (!options.toolbarTop) actionBar.hide(); - if (!options.toolbarTopBackgroundColor.isEmpty()) + if (options.toolbarTopBackgroundColor != null && !options.toolbarTopBackgroundColor.isEmpty()) actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(options.toolbarTopBackgroundColor))); - if (!options.toolbarTopFixedTitle.isEmpty()) + if (options.toolbarTopFixedTitle != null && !options.toolbarTopFixedTitle.isEmpty()) actionBar.setTitle(options.toolbarTopFixedTitle); } diff --git a/lib/src/types.dart b/lib/src/types.dart index 98814aff..cde38456 100644 --- a/lib/src/types.dart +++ b/lib/src/types.dart @@ -134,7 +134,7 @@ class CustomSchemeResponse { ///Public class representing a JavaScript console message from WebCore. ///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page. /// -///To receive notifications of these messages, override the [InAppBrowser.onConsoleMessage()] function. +///To receive notifications of these messages, use the [onConsoleMessage] event. class ConsoleMessage { String sourceURL = ""; @@ -198,7 +198,7 @@ class GeolocationPermissionShowPromptResponse { } } -/// +///JsAlertResponseAction class used by [JsAlertResponse] class. class JsAlertResponseAction { final int _value; const JsAlertResponseAction._internal(this._value); @@ -207,11 +207,15 @@ class JsAlertResponseAction { static const CONFIRM = const JsAlertResponseAction._internal(0); } -/// +///JsAlertResponse class represents the response used by the [onJsAlert] event to control a JavaScript alert dialog. class JsAlertResponse { + ///Message to be displayed in the window. String message; + ///Title of the confirm button. String confirmButtonTitle; + ///Whether the client will handle the alert dialog. bool handledByClient; + ///Action used to confirm that the user hit confirm button. JsAlertResponseAction action; JsAlertResponse({this.message = "", this.handledByClient = false, this.confirmButtonTitle = "", this.action = JsAlertResponseAction.CONFIRM}); @@ -226,7 +230,7 @@ class JsAlertResponse { } } -/// +///JsConfirmResponseAction class used by [JsConfirmResponse] class. class JsConfirmResponseAction { final int _value; const JsConfirmResponseAction._internal(this._value); @@ -236,12 +240,17 @@ class JsConfirmResponseAction { static const CANCEL = const JsConfirmResponseAction._internal(1); } -/// +///JsConfirmResponse class represents the response used by the [onJsConfirm] event to control a JavaScript confirm dialog. class JsConfirmResponse { + ///Message to be displayed in the window. String message; + ///Title of the confirm button. String confirmButtonTitle; + ///Title of the cancel button. String cancelButtonTitle; + ///Whether the client will handle the confirm dialog. bool handledByClient; + ///Action used to confirm that the user hit confirm or cancel button. JsConfirmResponseAction action; JsConfirmResponse({this.message = "", this.handledByClient = false, this.confirmButtonTitle = "", this.cancelButtonTitle = "", this.action = JsConfirmResponseAction.CANCEL}); @@ -257,7 +266,7 @@ class JsConfirmResponse { } } -/// +///JsPromptResponseAction class used by [JsPromptResponse] class. class JsPromptResponseAction { final int _value; const JsPromptResponseAction._internal(this._value); @@ -267,14 +276,21 @@ class JsPromptResponseAction { static const CANCEL = const JsPromptResponseAction._internal(1); } -/// +///JsPromptResponse class represents the response used by the [onJsPrompt] event to control a JavaScript prompt dialog. class JsPromptResponse { + ///Message to be displayed in the window. String message; + ///The default value displayed in the prompt dialog. String defaultValue; + ///Title of the confirm button. String confirmButtonTitle; + ///Title of the cancel button. String cancelButtonTitle; + ///Whether the client will handle the prompt dialog. bool handledByClient; + ///Value of the prompt dialog. String value; + ///Action used to confirm that the user hit confirm or cancel button. JsPromptResponseAction action; JsPromptResponse({this.message = "", this.defaultValue = "", this.handledByClient = false, this.confirmButtonTitle = "", this.cancelButtonTitle = "", this.value, this.action = JsPromptResponseAction.CANCEL}); @@ -310,7 +326,7 @@ class SafeBrowsingThreat { static const SAFE_BROWSING_THREAT_BILLING = const SafeBrowsingThreat._internal(4); } -/// +///SafeBrowsingResponseAction class used by [SafeBrowsingResponse] class. class SafeBrowsingResponseAction { final int _value; const SafeBrowsingResponseAction._internal(this._value); diff --git a/lib/src/webview_options.dart b/lib/src/webview_options.dart index 2e13827b..251fd32a 100644 --- a/lib/src/webview_options.dart +++ b/lib/src/webview_options.dart @@ -66,6 +66,8 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti ///Set to `true` to allow JavaScript open windows without user interaction. The default value is `false`. bool javaScriptCanOpenWindowsAutomatically; ///Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`. + /// + ///**NOTE**: available on iOS 10.0+. bool mediaPlaybackRequiresUserGesture; ///Sets the minimum font size. The default value is `8` for Android, `0` for iOS. int minimumFontSize; @@ -74,8 +76,12 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti ///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 [onLoadResourceCustomScheme] event to intercept resource requests with custom scheme. + /// + ///**NOTE**: available on iOS 11.0+. List resourceCustomSchemes; ///List of [ContentBlocker] that are a set of rules used to block content in the browser window. + /// + ///**NOTE**: available on iOS 11.0+. List contentBlockers; ///Sets the content mode that the WebView needs to use. The default value is [InAppWebViewUserPreferredContentMode.RECOMMENDED]. /// @@ -176,6 +182,7 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti } } +///This class represents all the Android-only WebView options available. class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions { ///Sets the text zoom of the page in percent. The default is `100`. int textZoom; @@ -400,19 +407,51 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr } } +///This class represents all the iOS-only WebView options available. class IosInAppWebViewOptions implements WebViewOptions, BrowserOptions, IosOptions { + ///Set to `true` to disable the bouncing of the WebView when the scrolling has reached an edge of the content. The default value is `false`. bool disallowOverScroll; + ///Set to `true` to allow a viewport meta tag to either disable or restrict the range of user scaling. The default value is `false`. bool enableViewportScale; + ///Set to `true` if you want the WebView suppresses content rendering until it is fully loaded into memory. The default value is `false`. bool suppressesIncrementalRendering; + ///Set to `true` to allow AirPlay. The default value is `true`. bool allowsAirPlayForMediaPlayback; + ///Set to `true` to allow the horizontal swipe gestures trigger back-forward list navigations. The default value is `true`. bool allowsBackForwardNavigationGestures; + ///Set to `true` to allow that pressing on a link displays a preview of the destination for the link. The default value is `true`. + /// + ///**NOTE**: available on iOS 9.0+. bool allowsLinkPreview; + ///Set to `true` if you want that the WebView should always allow scaling of the webpage, regardless of the author's intent. + ///The ignoresViewportScaleLimits property overrides the `user-scalable` HTML property in a webpage. The default value is `false`. bool ignoresViewportScaleLimits; + ///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 `